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, writeawaitWritable, awaitWritable, getWriteThread, isWriteResumed, isWriteShutdown, resumeWrites, setWriteReadyHandler, suspendWrites, wakeupWritesgetWorkerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitawaitWritable, awaitWritable, getWriteThread, isWriteResumed, isWriteShutdown, resumeWrites, setWriteReadyHandler, suspendWrites, wakeupWritespublic FinishableStreamSinkConduit(StreamSinkConduit delegate, ConduitListener<? super FinishableStreamSinkConduit> finishListener)
public 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 void terminateWrites()
throws IOException
SinkConduitSinkConduit.flush()ed before it is considered
to be shut down.terminateWrites in interface SinkConduitterminateWrites in class AbstractSinkConduit<StreamSinkConduit>IOExceptionpublic void truncateWrites()
throws IOException
SinkConduittruncateWrites in interface SinkConduittruncateWrites in class AbstractSinkConduit<StreamSinkConduit>IOException - if channel termination failed for some reasonpublic boolean flush()
throws IOException
SinkConduitflush in interface SinkConduitflush in class AbstractSinkConduit<StreamSinkConduit>true if everything is flushed, false otherwiseIOException - if flush failsCopyright © 2017 JBoss by Red Hat. All rights reserved.