Package java.nio
Class NioUtils
- java.lang.Object
-
- java.nio.NioUtils
-
public final class NioUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidfreeDirectBuffer(ByteBuffer buffer)static FileDescriptorgetFD(FileChannel fc)Returns the int file descriptor from within the given FileChannel 'fc'.static FileChannelnewFileChannel(Closeable ioObject, FileDescriptor fd, int mode)Helps bridge between io and nio.static byte[]unsafeArray(ByteBuffer b)Exposes the array backing a non-direct ByteBuffer, even if the ByteBuffer is read-only.static intunsafeArrayOffset(ByteBuffer b)Exposes the array offset for the array backing a non-direct ByteBuffer, even if the ByteBuffer is read-only.
-
-
-
Method Detail
-
freeDirectBuffer
public static void freeDirectBuffer(ByteBuffer buffer)
-
getFD
public static FileDescriptor getFD(FileChannel fc)
Returns the int file descriptor from within the given FileChannel 'fc'.
-
newFileChannel
public static FileChannel newFileChannel(Closeable ioObject, FileDescriptor fd, int mode)
Helps bridge between io and nio.
-
unsafeArray
public static byte[] unsafeArray(ByteBuffer b)
Exposes the array backing a non-direct ByteBuffer, even if the ByteBuffer is read-only. Normally, attempting to access the array backing a read-only buffer throws.
-
unsafeArrayOffset
public static int unsafeArrayOffset(ByteBuffer b)
Exposes the array offset for the array backing a non-direct ByteBuffer, even if the ByteBuffer is read-only.
-
-