public final class BlockingStreamSinkConduit extends AbstractStreamSinkConduit<StreamSinkConduit>
next
Constructor and Description |
---|
BlockingStreamSinkConduit(StreamSinkConduit next) |
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
WriteReadyHandler should be invoked as soon as data can be written
without blocking. |
void |
suspendWrites()
Indicate that calling the conduit's
WriteReadyHandler should be suspended. |
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
WriteReadyHandler should 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 offs,
int len)
Writes a sequence of bytes to this conduit from the given buffers.
|
awaitWritable, awaitWritable, getWriteThread, isWriteShutdown, setWriteReadyHandler, terminateWrites, truncateWrites
getWorker
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
awaitWritable, awaitWritable, getWriteThread, isWriteShutdown, setWriteReadyHandler, terminateWrites, truncateWrites
public BlockingStreamSinkConduit(StreamSinkConduit next)
public long transferFrom(FileChannel src, long position, long count) throws IOException
StreamSinkConduit
transferFrom
in interface StreamSinkConduit
transferFrom
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
StreamSinkConduit
throughBuffer
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 StreamSinkConduit
transferFrom
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 int write(ByteBuffer src) throws IOException
StreamSinkConduit
write
in interface StreamSinkConduit
write
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 offs, int len) throws IOException
StreamSinkConduit
write
in interface StreamSinkConduit
write
in class AbstractStreamSinkConduit<StreamSinkConduit>
srcs
- the buffers containing data to writeoffs
- the offset into the buffer arraylen
- the number of buffers to writeClosedChannelException
- if this conduit's SinkConduit.terminateWrites()
method was previously calledIOException
- if an error occurspublic boolean flush() throws IOException
SinkConduit
flush
in interface SinkConduit
flush
in class AbstractSinkConduit<StreamSinkConduit>
true
if everything is flushed, false
otherwiseIOException
- if flush failspublic void resumeWrites()
SinkConduit
WriteReadyHandler
should be invoked as soon as data can be written
without blocking.resumeWrites
in interface SinkConduit
resumeWrites
in class AbstractSinkConduit<StreamSinkConduit>
public void suspendWrites()
SinkConduit
WriteReadyHandler
should be suspended.suspendWrites
in interface SinkConduit
suspendWrites
in class AbstractSinkConduit<StreamSinkConduit>
public void wakeupWrites()
SinkConduit
WriteReadyHandler
should be invoked immediately, and then again as soon
as data can be written without blocking.wakeupWrites
in interface SinkConduit
wakeupWrites
in class AbstractSinkConduit<StreamSinkConduit>
public boolean isWriteResumed()
SinkConduit
isWriteResumed
in interface SinkConduit
isWriteResumed
in class AbstractSinkConduit<StreamSinkConduit>
true
if write notifications are enabledCopyright © 2013 JBoss, a division of Red Hat, Inc.. All rights reserved.