public final class StorageChannelUtils
Set of utility methods for working with non-blocking channels returned by this library.
Static Methods
blockingEmptyTo(ByteBuffer buf, WritableByteChannel c)
public static int blockingEmptyTo(ByteBuffer buf, WritableByteChannel c)
Attempt to empty buf
to c
, blocking the invoking thread if necessary in order
to do so.
This method will not close c
Parameters | |
---|---|
Name | Description |
buf |
ByteBuffer |
c |
WritableByteChannel |
Returns | |
---|---|
Type | Description |
int |
The number of bytes written, possibly zero |
Exceptions | |
---|---|
Type | Description |
IOException |
any IOException from calling WritableByteChannel#write(ByteBuffer) |
blockingFillFrom(ByteBuffer buf, ReadableByteChannel c)
public static int blockingFillFrom(ByteBuffer buf, ReadableByteChannel c)
Attempt to fill buf
from c
, blocking the invoking thread if necessary in order
to do so.
This method will not close c
.
Parameters | |
---|---|
Name | Description |
buf |
ByteBuffer |
c |
ReadableByteChannel |
Returns | |
---|---|
Type | Description |
int |
The number of bytes read, possibly zero, or |
Exceptions | |
---|---|
Type | Description |
IOException |
any IOException from calling ReadableByteChannel#read(ByteBuffer) |