public class NioUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
copy(ByteBuffer sourceBuffer,
ByteBuffer targetBuffer,
long maxCopied)
Writes the source buffer to the target buffer, up to a maximum number of
bytes.
|
static void |
copy(FileChannel fileChannel,
WritableByteChannel writableChannel)
Writes the representation to a byte channel.
|
static void |
copy(ReadableByteChannel readableChannel,
OutputStream outputStream)
Writes a NIO readable channel to a BIO output stream.
|
static void |
waitForState(SelectableChannel selectableChannel,
int operations)
Waits for the given channel to be ready for a specific operation.
|
public static int copy(ByteBuffer sourceBuffer, ByteBuffer targetBuffer, long maxCopied)
sourceBuffer - The source buffer.targetBuffer - The target buffer.maxCopied - The maximum number of bytes copied by this call or 0 for
unlimited length.public static void copy(FileChannel fileChannel, WritableByteChannel writableChannel) throws IOException
fileChannel - The readable file channel.writableChannel - A writable byte channel.IOExceptionpublic static void copy(ReadableByteChannel readableChannel, OutputStream outputStream) throws IOException
readableChannel - The readable channel.outputStream - The output stream.IOExceptionpublic static void waitForState(SelectableChannel selectableChannel, int operations) throws IOException
selectableChannel - The channel to monitor.operations - The operations to be ready to do.IOExceptionCopyright © 2005–2016. All rights reserved.