|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.restlet.engine.io.NioUtils
public class NioUtils
Utility methods for NIO processing.
| Method Summary | |
|---|---|
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 |
copy(ReadableByteChannel readableChannel,
WritableByteChannel writableChannel)
Writes a readable channel to a writable channel. |
static ReadableByteChannel |
getChannel(InputStream inputStream)
Returns a readable byte channel based on a given input stream. |
static WritableByteChannel |
getChannel(OutputStream outputStream)
Returns a writable byte channel based on a given output stream. |
static ReadableByteChannel |
getChannel(Representation representation)
Returns a readable byte channel based on the given representation's content and its write(WritableByteChannel) method. |
static InputStream |
getStream(ReadableByteChannel readableChannel)
Returns an input stream based on a given readable byte channel. |
static OutputStream |
getStream(WritableByteChannel writableChannel)
Returns an output stream based on a given writable byte channel. |
static boolean |
isBlocking(Channel channel)
Indicates if the channel is in blocking mode. |
static void |
release(Selector selector,
SelectionKey selectionKey)
Release the selection key, working around for bug #6403933. |
static void |
waitForState(SelectableChannel selectableChannel,
int operations)
Waits for the given channel to be ready for a specific operation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
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.
IOException
public static void copy(ReadableByteChannel readableChannel,
OutputStream outputStream)
throws IOException
readableChannel - The readable channel.outputStream - The output stream.
IOException
public static void copy(ReadableByteChannel readableChannel,
WritableByteChannel writableChannel)
throws IOException
readableChannel - The readable channel.writableChannel - The writable channel.
IOException
public static ReadableByteChannel getChannel(InputStream inputStream)
throws IOException
inputStream - The input stream to convert.
IOExceptionpublic static WritableByteChannel getChannel(OutputStream outputStream)
outputStream - The output stream.
public static ReadableByteChannel getChannel(Representation representation)
throws IOException
representation - the representation to get the OutputStream from.
IOExceptionpublic static InputStream getStream(ReadableByteChannel readableChannel)
readableChannel - The readable byte channel.
public static OutputStream getStream(WritableByteChannel writableChannel)
writableChannel - The writable byte channel.
public static boolean isBlocking(Channel channel)
channel - The channel to test.
public static void release(Selector selector,
SelectionKey selectionKey)
throws IOException
selector - The associated selector.selectionKey - The used selection key.
IOException
public static void waitForState(SelectableChannel selectableChannel,
int operations)
throws IOException
selectableChannel - The channel to monitor.operations - The operations to be ready to do.
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||