public class ByteChannel extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ByteChannel.BufferInputStream
Input stream used to read the data contained in a buffer instance.
|
static class |
ByteChannel.BufferOutputStream
Output stream used to write data into the buffer channel.
|
class |
ByteChannel.ByteBuffer
Object acting as a buffer of bytes.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE
The default buffer size in number of bytes.
|
static int |
DEFAULT_POOL_SIZE
The default core pool size.
|
| Modifier and Type | Method and Description |
|---|---|
static ByteChannel |
byteChannel()
Returns a new byte channel.
|
static ByteChannel |
byteChannel(int dataBufferSize)
Returns a new byte channel.
|
static ByteChannel |
byteChannel(int dataBufferSize,
int corePoolSize)
Returns a new byte channel.
|
static ByteChannel.BufferInputStream |
inputStream(ByteChannel.ByteBuffer... buffers)
Creates an input stream returning the concatenation of the data contained in the specified
buffers.
Note that only one input stream can be created for each buffer. |
static ByteChannel.BufferInputStream |
inputStream(ByteChannel.ByteBuffer buffer)
Creates an input stream returning the data contained in the specified buffer.
Note that only one input stream can be created for each buffer. |
static ByteChannel.BufferInputStream |
inputStream(List<ByteChannel.ByteBuffer> buffers)
Creates an input stream returning the concatenation of the data contained in the specified
buffers.
Note that only one input stream can be created for each buffer. |
ByteChannel.BufferOutputStream |
passTo(Channel.InputChannel<? super ByteChannel.ByteBuffer> channel)
Returns the output stream used to write bytes into the specified channel.
|
ByteChannel.BufferOutputStream |
passTo(IOChannel<? super ByteChannel.ByteBuffer,?> channel)
Returns the output stream used to write bytes into the specified channel.
Note that the channel will be automatically closed as soon as the returned output stream is closed. |
public static final int DEFAULT_BUFFER_SIZE
public static final int DEFAULT_POOL_SIZE
@NotNull public static ByteChannel byteChannel()
@NotNull public static ByteChannel byteChannel(int dataBufferSize)
dataBufferSize - the size of the data buffer used to transfer the bytes through the
routine channels.IllegalArgumentException - if the specified size is 0 or negative.@NotNull public static ByteChannel byteChannel(int dataBufferSize, int corePoolSize)
dataBufferSize - the size of the data buffer used to transfer the bytes through the
routine channels.corePoolSize - the maximum number of data retained in the pool. Additional data
created to fulfill the bytes requirement will be discarded.IllegalArgumentException - if the specified size is 0 or negative.@NotNull public static ByteChannel.BufferInputStream inputStream(@NotNull ByteChannel.ByteBuffer buffer)
buffer - the byte buffer.IllegalStateException - if an input stream has been already created for the
specified buffer.@NotNull public static ByteChannel.BufferInputStream inputStream(@NotNull ByteChannel.ByteBuffer... buffers)
buffers - the byte buffers whose data have to be concatenated.IllegalStateException - if an input stream has been already created for one
of the specified buffers.@NotNull public static ByteChannel.BufferInputStream inputStream(@NotNull List<ByteChannel.ByteBuffer> buffers)
buffers - the byte buffers whose data have to be concatenated.IllegalStateException - if an input stream has been already created for one
of the specified buffers.@NotNull public ByteChannel.BufferOutputStream passTo(@NotNull Channel.InputChannel<? super ByteChannel.ByteBuffer> channel)
channel - the input channel to which pass the data.@NotNull public ByteChannel.BufferOutputStream passTo(@NotNull IOChannel<? super ByteChannel.ByteBuffer,?> channel)
channel - the I/O channel to which pass the data.