public final class HeadStreamSinkConduit extends AbstractStreamSinkConduit<StreamSinkConduit>
next| Constructor and Description | 
|---|
| HeadStreamSinkConduit(StreamSinkConduit next,
                     ConduitListener<? super HeadStreamSinkConduit> finishListener)Construct a new instance. | 
| HeadStreamSinkConduit(StreamSinkConduit next,
                     ConduitListener<? super HeadStreamSinkConduit> finishListener,
                     boolean shutdownDelegate)Construct a new instance. | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | flush()Flush out any unwritten, buffered output. | 
| boolean | isWriteResumed()Determine whether write notifications are currently enabled. | 
| void | resumeWrites()Indicate that the conduit's  WriteReadyHandlershould be invoked as soon as data can be written
 without blocking. | 
| void | suspendWrites()Indicate that calling the conduit's  WriteReadyHandlershould be suspended. | 
| void | terminateWrites()Signal that no more write data is forthcoming. | 
| long | transferFrom(FileChannel src,
            long position,
            long count)Transfer bytes into this conduit from the given file. | 
| long | transferFrom(StreamSourceChannel source,
            long count,
            ByteBuffer throughBuffer)Transfers bytes from the given channel source. | 
| void | wakeupWrites()Indicate that the conduit's  WriteReadyHandlershould be invoked immediately, and then again as soon
 as data can be written without blocking. | 
| int | write(ByteBuffer src)Writes a sequence of bytes to this conduit from the given buffer. | 
| long | write(ByteBuffer[] srcs,
     int offset,
     int length)Writes a sequence of bytes to this conduit from the given buffers. | 
| int | writeFinal(ByteBuffer src)Writes some data to the conduit, with the same semantics as
  StreamSinkConduit.write(java.nio.ByteBuffer). | 
| long | writeFinal(ByteBuffer[] srcs,
          int offset,
          int length)Writes some data to the conduit, with the same semantics as
  StreamSinkConduit.write(java.nio.ByteBuffer[], int, int). | 
awaitWritable, awaitWritable, getWriteThread, isWriteShutdown, setWriteReadyHandler, truncateWritesgetWorkerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitawaitWritable, awaitWritable, getWriteThread, isWriteShutdown, setWriteReadyHandler, truncateWritespublic HeadStreamSinkConduit(StreamSinkConduit next, ConduitListener<? super HeadStreamSinkConduit> finishListener)
next - the next channelfinishListener - the listener to call when the channel is closed or the length is reachedpublic HeadStreamSinkConduit(StreamSinkConduit next, ConduitListener<? super HeadStreamSinkConduit> finishListener, boolean shutdownDelegate)
next - the next channelfinishListener - the listener to call when the channel is closed or the length is reachedpublic int write(ByteBuffer src) throws IOException
StreamSinkConduitwrite in interface StreamSinkConduitwrite in class AbstractStreamSinkConduit<StreamSinkConduit>src - the buffer containing data to writeClosedChannelException - if this conduit's SinkConduit.terminateWrites() method was previously calledIOException - if an error occurspublic long write(ByteBuffer[] srcs, int offset, int length) throws IOException
StreamSinkConduitwrite in interface StreamSinkConduitwrite in class AbstractStreamSinkConduit<StreamSinkConduit>srcs - the buffers containing data to writeoffset - the offset into the buffer arraylength - the number of buffers to writeClosedChannelException - if this conduit's SinkConduit.terminateWrites() method was previously calledIOException - if an error occurspublic int writeFinal(ByteBuffer src) throws IOException
StreamSinkConduitStreamSinkConduit.write(java.nio.ByteBuffer). If all the data is written
 out then the conduit will have its writes terminated. Semantically this
 method is equivalent to:
 
     int rem = src.remaining();
     int written = conduit.write(src);
     if(written == rem) {
         conduit.terminateWrites()
     }
 writeFinal in interface StreamSinkConduitwriteFinal in class AbstractStreamSinkConduit<StreamSinkConduit>src - The data to writeIOExceptionpublic long writeFinal(ByteBuffer[] srcs, int offset, int length) throws IOException
StreamSinkConduitStreamSinkConduit.write(java.nio.ByteBuffer[], int, int). If all the data is written
 out then the conduit will have its writes terminated.writeFinal in interface StreamSinkConduitwriteFinal in class AbstractStreamSinkConduit<StreamSinkConduit>srcs - The buffers from which bytes are to be retrievedoffset - The offset within the buffer array of the first buffer from
         which bytes are to be retrieved; must be non-negative and no
         larger than srcs.lengthlength - The maximum number of buffers to be accessed; must be
         non-negative and no larger than
         srcs.length - offsetIOExceptionpublic long transferFrom(FileChannel src, long position, long count) throws IOException
StreamSinkConduittransferFrom in interface StreamSinkConduittransferFrom in class AbstractStreamSinkConduit<StreamSinkConduit>src - the file to read fromposition - the position within the file from which the transfer is to begincount - the number of bytes to be transferredIOException - if an I/O error occurspublic long transferFrom(StreamSourceChannel source, long count, ByteBuffer throughBuffer) throws IOException
StreamSinkConduitthroughBuffer will be cleared.  On exit, the
 buffer will be flipped for emptying, and may 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 source
 which must be written to this channel to complete the operation.transferFrom in interface StreamSinkConduittransferFrom in class AbstractStreamSinkConduit<StreamSinkConduit>source - the source to read fromcount - the number of bytes to be transferredthroughBuffer - the buffer to copy through.IOException - if an I/O error occurspublic boolean flush()
              throws IOException
SinkConduitflush in interface SinkConduitflush in class AbstractSinkConduit<StreamSinkConduit>true if everything is flushed, false otherwiseIOException - if flush failspublic void suspendWrites()
SinkConduitWriteReadyHandler should be suspended.suspendWrites in interface SinkConduitsuspendWrites in class AbstractSinkConduit<StreamSinkConduit>public void resumeWrites()
SinkConduitWriteReadyHandler should be invoked as soon as data can be written
 without blocking.resumeWrites in interface SinkConduitresumeWrites in class AbstractSinkConduit<StreamSinkConduit>public boolean isWriteResumed()
SinkConduitisWriteResumed in interface SinkConduitisWriteResumed in class AbstractSinkConduit<StreamSinkConduit>true if write notifications are enabledpublic void wakeupWrites()
SinkConduitWriteReadyHandler should be invoked immediately, and then again as soon
 as data can be written without blocking.wakeupWrites in interface SinkConduitwakeupWrites in class AbstractSinkConduit<StreamSinkConduit>public void terminateWrites()
                     throws IOException
SinkConduitSinkConduit.flush()ed before it is considered
 to be shut down.terminateWrites in interface SinkConduitterminateWrites in class AbstractSinkConduit<StreamSinkConduit>IOExceptionCopyright © 2016 JBoss by Red Hat. All rights reserved.