public final class FinishableStreamSinkConduit extends AbstractStreamSinkConduit<StreamSinkConduit>
next
Constructor and Description |
---|
FinishableStreamSinkConduit(StreamSinkConduit delegate,
ConduitListener<? super FinishableStreamSinkConduit> finishListener) |
Modifier and Type | Method and Description |
---|---|
boolean |
flush()
Flush out any unwritten, buffered output.
|
void |
terminateWrites()
Signal that no more write data is forthcoming.
|
void |
truncateWrites()
Terminate writes and discard any outstanding write data.
|
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) . |
transferFrom, transferFrom, write, write
awaitWritable, awaitWritable, getWriteThread, isWriteResumed, isWriteShutdown, resumeWrites, setWriteReadyHandler, suspendWrites, wakeupWrites
getWorker
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
awaitWritable, awaitWritable, getWriteThread, isWriteResumed, isWriteShutdown, resumeWrites, setWriteReadyHandler, suspendWrites, wakeupWrites
public FinishableStreamSinkConduit(StreamSinkConduit delegate, ConduitListener<? super FinishableStreamSinkConduit> finishListener)
public int writeFinal(ByteBuffer src) throws IOException
StreamSinkConduit
StreamSinkConduit.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 StreamSinkConduit
writeFinal
in class AbstractStreamSinkConduit<StreamSinkConduit>
src
- The data to writeIOException
public long writeFinal(ByteBuffer[] srcs, int offset, int length) throws IOException
StreamSinkConduit
StreamSinkConduit.write(java.nio.ByteBuffer[], int, int)
. If all the data is written
out then the conduit will have its writes terminated.writeFinal
in interface StreamSinkConduit
writeFinal
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 - offsetIOException
public void terminateWrites() throws IOException
SinkConduit
SinkConduit.flush()
ed before it is considered
to be shut down.terminateWrites
in interface SinkConduit
terminateWrites
in class AbstractSinkConduit<StreamSinkConduit>
IOException
public void truncateWrites() throws IOException
SinkConduit
truncateWrites
in interface SinkConduit
truncateWrites
in class AbstractSinkConduit<StreamSinkConduit>
IOException
- if channel termination failed for some reasonpublic boolean flush() throws IOException
SinkConduit
flush
in interface SinkConduit
flush
in class AbstractSinkConduit<StreamSinkConduit>
true
if everything is flushed, false
otherwiseIOException
- if flush failsCopyright © 2020 JBoss by Red Hat. All rights reserved.