public final class PushBackStreamSourceConduit extends AbstractStreamSourceConduit<StreamSourceConduit> implements StreamSourceConduit
next| Constructor and Description | 
|---|
| PushBackStreamSourceConduit(StreamSourceConduit next)Construct a new instance. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | awaitReadable()Block until this channel becomes readable again. | 
| void | awaitReadable(long time,
             TimeUnit timeUnit)Block until this conduit becomes readable again, or until the timeout expires. | 
| void | pushBack(Pooled<ByteBuffer> pooledBuffer)Push a buffer back to the head of the stream. | 
| int | read(ByteBuffer dst)Read a sequence of bytes from this conduit to the given buffer. | 
| long | read(ByteBuffer[] dsts,
    int offs,
    int len)Read a sequence of bytes from this conduit to the given buffers. | 
| void | resumeReads()Indicate that the conduit's  ReadReadyHandlershould be invoked as soon as data can be read
 without blocking. | 
| void | setReadReadyHandler(ReadReadyHandler handler)Set the handler which should receive readiness notifications. | 
| void | terminateReads()Indicate that no more data will be read from this conduit. | 
| long | transferTo(long count,
          ByteBuffer throughBuffer,
          StreamSinkChannel target)Transfers bytes into the given channel target. | 
| long | transferTo(long position,
          long count,
          FileChannel target)Transfers bytes into the given file from this channel. | 
getReadThread, isReadResumed, isReadShutdown, suspendReads, wakeupReadsgetWorkerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetReadThread, isReadResumed, isReadShutdown, suspendReads, wakeupReadspublic PushBackStreamSourceConduit(StreamSourceConduit next)
next - the delegate conduit to setpublic void resumeReads()
SourceConduitReadReadyHandler should be invoked as soon as data can be read
 without blocking.resumeReads in interface SourceConduitresumeReads in class AbstractSourceConduit<StreamSourceConduit>public int read(ByteBuffer dst) throws IOException
StreamSourceConduitread in interface StreamSourceConduitread in class AbstractStreamSourceConduit<StreamSourceConduit>SourceConduit.terminateReads() method was previously calledIOException - if an error occurspublic long read(ByteBuffer[] dsts, int offs, int len) throws IOException
StreamSourceConduitread in interface StreamSourceConduitread in class AbstractStreamSourceConduit<StreamSourceConduit>offs - the offset into the buffer arraylen - the number of buffers to fillSourceConduit.terminateReads() method was previously calledIOException - if an error occurspublic long transferTo(long position,
                       long count,
                       FileChannel target)
                throws IOException
StreamSourceConduittransferTo in interface StreamSourceConduittransferTo in class AbstractStreamSourceConduit<StreamSourceConduit>position - the position within the file from which the transfer is to begincount - the number of bytes to be transferredtarget - the file to write toIOException - if an I/O error occurspublic long transferTo(long count,
                       ByteBuffer throughBuffer,
                       StreamSinkChannel target)
                throws IOException
StreamSourceConduitthroughBuffer will be cleared.  On exit, the buffer will be
 flipped for emptying, and may possibly be empty or may contain data.  If this method returns a value less than
 count, then the remaining data in throughBuffer may contain data read from this channel which must
 be written to target to complete the operation.transferTo in interface StreamSourceConduittransferTo in class AbstractStreamSourceConduit<StreamSourceConduit>count - the number of bytes to be transferredthroughBuffer - the buffer to copy through.target - the destination to write toIOException - if an I/O error occurspublic void awaitReadable()
                   throws IOException
SourceConduitawaitReadable in interface SourceConduitawaitReadable in class AbstractSourceConduit<StreamSourceConduit>InterruptedIOException - if the operation is interrupted; the thread's interrupt flag will be set as wellIOException - if an I/O error occurspublic void awaitReadable(long time,
                          TimeUnit timeUnit)
                   throws IOException
SourceConduitawaitReadable in interface SourceConduitawaitReadable in class AbstractSourceConduit<StreamSourceConduit>time - the time to waittimeUnit - the time unitInterruptedIOException - if the operation is interrupted; the thread's interrupt flag will be set as wellIOException - if an I/O error occurspublic void terminateReads()
                    throws IOException
SourceConduitterminateReads in interface SourceConduitterminateReads in class AbstractSourceConduit<StreamSourceConduit>IOException - if there was a problempublic void setReadReadyHandler(ReadReadyHandler handler)
SourceConduitsetReadReadyHandler in interface SourceConduitsetReadReadyHandler in class AbstractSourceConduit<StreamSourceConduit>public void pushBack(Pooled<ByteBuffer> pooledBuffer)
pooledBuffer - the buffer to push backCopyright © 2017 JBoss by Red Hat. All rights reserved.