public class ByteBuffers extends Object
| Modifier and Type | Field and Description |
|---|---|
static boolean |
ADDRESS_AVAILABLE
This flag indicates whether
getAddress(ByteBuffer) utility is available. |
| Constructor and Description |
|---|
ByteBuffers() |
| Modifier and Type | Method and Description |
|---|---|
static ByteBuffer |
allocate(int capacity,
ByteOrder order)
The replacement for
ByteBuffer.allocate(int) that requires to specify the byte order. |
static ByteBuffer |
allocateDirect(int capacity,
ByteOrder order)
The replacement for
ByteBuffer.allocateDirect(int) that requires to specify the byte order. |
static ByteBuffer |
allocateDirectAligned(int size,
int alignment,
ByteOrder order) |
static ByteBuffer |
asReadOnlyBuffer(ByteBuffer source)
This method replaces
ByteBuffer.asReadOnlyBuffer(), with the difference that it preserves the source
buffer's order in the read-only view. |
static ByteBuffer |
duplicate(ByteBuffer toDuplicate)
This method replaces
ByteBuffer.duplicate(), with the difference that it preserves the source buffer's
order in the duplicate. |
static void |
freeDirectByteBuffer(ByteBuffer buffer)
Frees a direct ByteBuffer on the best-effort basis (if this functionality is available on the current JVM, with
the current security policy, etc.)
|
static long |
getAddress(ByteBuffer b)
Returns the actual native address the given direct ByteBuffer.
|
static boolean |
isFreeDirectByteBufferAvailable() |
static MappedByteBuffer |
map(FileChannel channel,
FileChannel.MapMode mode,
long position,
long size,
ByteOrder order)
The replacement for
FileChannel.map(java.nio.channels.FileChannel.MapMode, long, long) that requires to specify the byte order. |
static ByteBuffer |
slice(ByteBuffer toSlice)
This method replaces
ByteBuffer.slice(), with the difference that it preserves the source buffer's order
in the slice. |
static ByteBuffer |
wrap(byte[] array,
ByteOrder order)
The replacement for
ByteBuffer.wrap(byte[], int, int) that requires to specify the byte order. |
static ByteBuffer |
wrap(byte[] array,
int offset,
int length,
ByteOrder order)
The replacement for
ByteBuffer.wrap(byte[], int, int) that requires to specify the byte order. |
public static final boolean ADDRESS_AVAILABLE
getAddress(ByteBuffer) utility is available. If it's not (this flag value
is false), the method throws UnsupportedOperationException.public static ByteBuffer allocate(int capacity, ByteOrder order)
ByteBuffer.allocate(int) that requires to specify the byte order.public static ByteBuffer wrap(byte[] array, ByteOrder order)
ByteBuffer.wrap(byte[], int, int) that requires to specify the byte order.public static ByteBuffer wrap(byte[] array, int offset, int length, ByteOrder order)
ByteBuffer.wrap(byte[], int, int) that requires to specify the byte order.public static ByteBuffer allocateDirect(int capacity, ByteOrder order)
ByteBuffer.allocateDirect(int) that requires to specify the byte order.public static MappedByteBuffer map(FileChannel channel, FileChannel.MapMode mode, long position, long size, ByteOrder order) throws IOException
FileChannel.map(java.nio.channels.FileChannel.MapMode, long, long) that requires to specify the byte order.IOExceptionpublic static ByteBuffer slice(ByteBuffer toSlice)
ByteBuffer.slice(), with the difference that it preserves the source buffer's order
in the slice. ByteBuffer.slice() returns a buffer that is always BIG_ENDIAN, that is error-prone.public static ByteBuffer duplicate(ByteBuffer toDuplicate)
ByteBuffer.duplicate(), with the difference that it preserves the source buffer's
order in the duplicate. ByteBuffer.duplicate() returns a buffer that is always BIG_ENDIAN, that is
error-prone.public static ByteBuffer asReadOnlyBuffer(ByteBuffer source)
ByteBuffer.asReadOnlyBuffer(), with the difference that it preserves the source
buffer's order in the read-only view. ByteBuffer.asReadOnlyBuffer() returns a buffer that is always
BIG_ENDIAN, that is error-prone.public static long getAddress(ByteBuffer b)
IllegalArgumentException - if the given ByteBuffer is not directUnsupportedOperationException - if ADDRESS_AVAILABLE == falsepublic static ByteBuffer allocateDirectAligned(int size, int alignment, ByteOrder order)
public static void freeDirectByteBuffer(ByteBuffer buffer)
buffer - the direct ByteBuffer to freeIllegalArgumentException - if the given buffer is not directpublic static boolean isFreeDirectByteBufferAvailable()
Copyright © 2010-2016 Stardog Union. All Rights Reserved.