Class NioUtils
- java.lang.Object
-
- org.restlet.ext.nio.internal.util.NioUtils
-
@Deprecated public class NioUtils extends java.lang.ObjectDeprecated.Will be removed to favor lower-level network extensions allowing more control at the Restlet API level.Utility methods for NIO processing.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateNioUtils()Deprecated.Private constructor to ensure that the class acts as a true utility class i.e.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static intcopy(java.nio.ByteBuffer sourceBuffer, java.nio.ByteBuffer targetBuffer, long maxCopied)Deprecated.Writes the source buffer to the target buffer, up to a maximum number of bytes.static voidcopy(java.nio.channels.FileChannel fileChannel, java.nio.channels.WritableByteChannel writableChannel)Deprecated.Writes the representation to a byte channel.static voidcopy(java.nio.channels.ReadableByteChannel readableChannel, java.io.OutputStream outputStream)Deprecated.Writes a NIO readable channel to a BIO output stream.static voidwaitForState(java.nio.channels.SelectableChannel selectableChannel, int operations)Deprecated.Waits for the given channel to be ready for a specific operation.
-
-
-
Method Detail
-
copy
public static int copy(java.nio.ByteBuffer sourceBuffer, java.nio.ByteBuffer targetBuffer, long maxCopied)Deprecated.Writes the source buffer to the target buffer, up to a maximum number of bytes.- Parameters:
sourceBuffer- The source buffer.targetBuffer- The target buffer.maxCopied- The maximum number of bytes copied by this call or 0 for unlimited length.- Returns:
- The number of bytes added to the target buffer.
-
copy
public static void copy(java.nio.channels.FileChannel fileChannel, java.nio.channels.WritableByteChannel writableChannel) throws java.io.IOExceptionDeprecated.Writes the representation to a byte channel. Optimizes using the file channel transferTo method.- Parameters:
fileChannel- The readable file channel.writableChannel- A writable byte channel.- Throws:
java.io.IOException
-
copy
public static void copy(java.nio.channels.ReadableByteChannel readableChannel, java.io.OutputStream outputStream) throws java.io.IOExceptionDeprecated.Writes a NIO readable channel to a BIO output stream.- Parameters:
readableChannel- The readable channel.outputStream- The output stream.- Throws:
java.io.IOException
-
waitForState
public static void waitForState(java.nio.channels.SelectableChannel selectableChannel, int operations) throws java.io.IOExceptionDeprecated.Waits for the given channel to be ready for a specific operation.- Parameters:
selectableChannel- The channel to monitor.operations- The operations to be ready to do.- Throws:
java.io.IOException
-
-