public final class Conduits extends Object
Constructor and Description |
---|
Conduits() |
Modifier and Type | Method and Description |
---|---|
static long |
drain(StreamSourceConduit conduit,
long count)
Attempt to drain the given number of bytes from the stream source conduit.
|
static boolean |
sendFinalBasic(MessageSinkConduit conduit,
ByteBuffer src)
Writes a message to the conduit, and terminates writes if the send was successfully.
|
static boolean |
sendFinalBasic(MessageSinkConduit conduit,
ByteBuffer[] srcs,
int offset,
int length)
Writes a message to the conduit, and terminates writes if the send was successfully.
|
static long |
transfer(ReadableByteChannel source,
long count,
ByteBuffer throughBuffer,
StreamSinkConduit sink)
Platform-independent channel-to-channel transfer method.
|
static long |
transfer(StreamSourceConduit source,
long count,
ByteBuffer throughBuffer,
WritableByteChannel sink)
Platform-independent channel-to-channel transfer method.
|
static int |
writeFinalBasic(StreamSinkConduit conduit,
ByteBuffer src)
Writes the buffer to the conduit, and terminates writes if all the data is written
|
static long |
writeFinalBasic(StreamSinkConduit conduit,
ByteBuffer[] srcs,
int offset,
int length)
Writes the buffer to the conduit, and terminates writes if all the data is written
|
public static long transfer(StreamSourceConduit source, long count, ByteBuffer throughBuffer, WritableByteChannel sink) throws IOException
read
and write
operations
to move bytes from the source
channel to the sink
channel. After this call, the throughBuffer
should be checked for remaining bytes; if there are any, they should be written to the sink
channel before
proceeding. This method may be used with NIO channels, XNIO channels, or a combination of the two.
If either or both of the given channels are blocking channels, then this method may block.
source
- the source channel to read bytes fromcount
- the number of bytes to transfer (must be >= 0L
)throughBuffer
- the buffer to transfer through (must not be null
)sink
- the sink channel to write bytes toIOException
- if an I/O error occurs during the transfer of bytespublic static long transfer(ReadableByteChannel source, long count, ByteBuffer throughBuffer, StreamSinkConduit sink) throws IOException
read
and write
operations
to move bytes from the source
channel to the sink
channel. After this call, the throughBuffer
should be checked for remaining bytes; if there are any, they should be written to the sink
channel before
proceeding. This method may be used with NIO channels, XNIO channels, or a combination of the two.
If either or both of the given channels are blocking channels, then this method may block.
source
- the source channel to read bytes fromcount
- the number of bytes to transfer (must be >= 0L
)throughBuffer
- the buffer to transfer through (must not be null
)sink
- the sink channel to write bytes toIOException
- if an I/O error occurs during the transfer of bytespublic static int writeFinalBasic(StreamSinkConduit conduit, ByteBuffer src) throws IOException
conduit
- The conduit to write tosrc
- The data to writeIOException
public static long writeFinalBasic(StreamSinkConduit conduit, ByteBuffer[] srcs, int offset, int length) throws IOException
conduit
- The conduit to write tosrcs
- The data to writeoffset
- The offset into the data arraylength
- The number of buffers to writeIOException
public static boolean sendFinalBasic(MessageSinkConduit conduit, ByteBuffer src) throws IOException
conduit
- The conduitsrc
- The message buffertrue
if the message was sent successfullyIOException
public static boolean sendFinalBasic(MessageSinkConduit conduit, ByteBuffer[] srcs, int offset, int length) throws IOException
conduit
- The conduitsrcs
- The message buffersoffset
- The offset in the message bufferslength
- The number of buffers to sendtrue
if the message was sent successfullyIOException
public static long drain(StreamSourceConduit conduit, long count) throws IOException
conduit
- the conduit to draincount
- the number of bytesIOException
- if an error occursCopyright © 2017 JBoss by Red Hat. All rights reserved.