java.nio.Buffer manipulations.
| Modifier and Type | Field and Description |
|---|---|
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public static ByteBuffer | copyByteBuffer(final ByteBuffer orig)
Copies the remaining elements (as defined by
|
| public static FloatBuffer | copyFloatBuffer(final FloatBuffer orig)
Copies the remaining elements (as defined by
|
| public static ByteBuffer | copyFloatBufferAsByteBuffer(final FloatBuffer orig)
Copies the remaining elements (as defined by
|
| public static IntBuffer | copyIntBuffer(final IntBuffer orig)
Copies the remaining elements (as defined by
|
| public static ByteBuffer | copyIntBufferAsByteBuffer(final IntBuffer orig)
Copies the remaining elements (as defined by
|
| public static ShortBuffer | copyShortBuffer(final ShortBuffer orig)
Copies the remaining elements (as defined by
|
| public static ByteBuffer | copyShortBufferAsByteBuffer(final ShortBuffer orig)
Copies the remaining elements (as defined by
|
| public static Object | |
| public static int | getDirectBufferByteOffset(final Object buf)
Helper routine to get the Buffer byte offset by taking into account the Buffer position and the underlying type. |
| public static double[] | Returns: the passed or newly created target arraythe source array source, final int the offset soffset, double[] the target array, if null, a new array is being created with size len. dest, int the offset in the dest array doffset, int the payload of elements to be copied, if len)len < 0 then len = source.length - soffset
|
| public static DoubleBuffer | Returns: the passed or newly created target bufferthe source buffer, which elements from it's current position and it's limit are being copied source, DoubleBuffer the target buffer, if null, a new buffer is being created with size source.remaining() dest)No rewind or repositioning is performed. |
| public static float[] | Returns: the passed or newly created target arraythe source array source, final int the offset soffset, float[] the target array, if null, a new array is being created with size len. dest, int the offset in the dest array doffset, int the payload of elements to be copied, if len)len < 0 then len = source.length - soffset
|
| public static FloatBuffer | Returns: the passed or newly created target bufferthe source buffer, which elements from it's current position and it's limit are being copied source, FloatBuffer the target buffer, if null, a new buffer is being created with size source.remaining() dest)No rewind or repositioning is performed. |
| public static int | getIndirectBufferByteOffset(final Object buf)
Helper routine to get the full byte offset from the beginning of the array that is the storage for the indirect Buffer object. |
| public static boolean | |
| public static ByteBuffer | nativeOrder(final ByteBuffer buf)
Helper routine to set a ByteBuffer to the native byte order, if that operation is supported by the underlying NIO implementation. |
| public static ByteBuffer | newDirectByteBuffer(final int numElements)
Allocates a new direct ByteBuffer with the specified number of elements. |
| public static ByteBuffer | |
| public static ByteBuffer | |
| public static ByteBuffer | |
| public static CharBuffer | newDirectCharBuffer(final int numElements)
Allocates a new direct CharBuffer with the specified number of elements. |
| public static CharBuffer | |
| public static CharBuffer | |
| public static CharBuffer | |
| public static DoubleBuffer | newDirectDoubleBuffer(final int numElements)
Allocates a new direct DoubleBuffer with the specified number of elements. |
| public static DoubleBuffer | |
| public static DoubleBuffer | |
| public static DoubleBuffer | |
| public static FloatBuffer | newDirectFloatBuffer(final int numElements)
Allocates a new direct FloatBuffer with the specified number of elements. |
| public static FloatBuffer | |
| public static FloatBuffer | |
| public static FloatBuffer | |
| public static IntBuffer | newDirectIntBuffer(final int numElements)
Allocates a new direct IntBuffer with the specified number of elements. |
| public static IntBuffer | |
| public static IntBuffer | |
| public static IntBuffer | |
| public static LongBuffer | newDirectLongBuffer(final int numElements)
Allocates a new direct LongBuffer with the specified number of elements. |
| public static LongBuffer | |
| public static LongBuffer | |
| public static LongBuffer | |
| public static ShortBuffer | newDirectShortBuffer(final int numElements)
Allocates a new direct ShortBuffer with the specified number of elements. |
| public static ShortBuffer | |
| public static ShortBuffer | |
| public static ShortBuffer | |
| public static <B extends Buffer> B | |
| public static <B extends Buffer> B | |
| public static <B extends Buffer> B | |
| public static <B extends Buffer> B | |
| public static <B extends Buffer> B | |
| public static <B extends Buffer> B | putNb(final B dest, final boolean
true if destination buffer holds signed values, false if destination buffer holds unsigned values dSigned, final byte source byte value to be put in dest buffer v, final boolean true if source represents a signed value, false if source represents an unsigned value sSigned)Store byte source value in given buffer after normalizing it to the destination value range considering signed and unsigned source and destination representation. |
| public static <B extends Buffer> B | putNf(final B dest, final boolean
true if destination buffer holds signed values, false if destination buffer holds unsigned values dSigned, final float source float value to be put in dest buffer v)Store float source value in given buffer after normalizing it to the destination value range considering signed and unsigned destination representation. |
| public static <B extends Buffer> B | putNi(final B dest, final boolean
true if destination buffer holds signed values, false if destination buffer holds unsigned values dSigned, final int source short value to be put in dest buffer v, final boolean true if source represents a signed value, false if source represents an unsigned value sSigned)Store short source value in given buffer after normalizing it to the destination value range considering signed and unsigned source and destination representation. |
| public static <B extends Buffer> B | putNs(final B dest, final boolean
true if destination buffer holds signed values, false if destination buffer holds unsigned values dSigned, final short source short value to be put in dest buffer v, final boolean true if source represents a signed value, false if source represents an unsigned value sSigned)Store short source value in given buffer after normalizing it to the destination value range considering signed and unsigned source and destination representation. |
| public static <B extends Buffer> B | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | |
| public static void | rangeCheckBytes(final Object
buffer to test for minimum buffer, final int minimum bytes remaining minBytesRemaining)
|
| public static int | Returns: Ifbuffer is null, returns 0Anonymous Buffer of type buffer)NativeBuffer or a derivation of Buffer.Returns the number of remaining bytes of the given anonymous |
| public static int | Returns: Ifbuffer is null, returns 0Anonymous Buffer of type buffer)NativeBuffer or a derivation of Buffer.Returns the number of remaining elements of the given anonymous |
| public static int | sizeOfBufferElem(final Object buffer)
Returns the size of a single element of the given buffer in bytes
or |
| public static <B extends Buffer> B | |
| public static <B extends Buffer> B | slice(final B buffer, final int offset, final int size)
Slices the specified buffer with offset as position and offset+size as limit while maintaining the byteorder. |
| public static final FloatBuffer | Returns: FloatBuffer w/ native byte order as given ByteBuffersource Buffer, maybe ByteBuffer (recommended) or FloatBuffer.
Buffer's position is ignored and floatPos is being used. buf, final int Buffers#SIZEOF_FLOAT positionBuffers#SIZEOF_FLOAT sizeSlices a ByteBuffer or a FloatBuffer to a FloatBuffer at the given position with the given size in float-space. |
| public static final FloatBuffer | Returns: FloatBuffer w/ native byte order as given ByteBuffersource float array backing, final int Buffers#SIZEOF_FLOAT positionBuffers#SIZEOF_FLOAT sizeSlices a primitive float backing array to a FloatBuffer at the given position with the given size
in float-space by |
| public static StringBuilder | Returns: the modified StringBuilder containing the Buffer detailsoptional pass through StringBuilder sb, final String optional format string of one element, i.e. "%10.5f" for f, final Buffer FloatBuffer, see java.,
or null for unformatted outputNote Caller is responsible to match the format string w/ the data type as expected in the given buffer. Any valid Buffer instance buffer)Appends Buffer details inclusive data to a StringBuilder instance. |
| SIZEOF_BYTE | back to summary |
|---|---|
| public static final int SIZEOF_BYTE | |
| SIZEOF_CHAR | back to summary |
|---|---|
| public static final int SIZEOF_CHAR | |
| SIZEOF_DOUBLE | back to summary |
|---|---|
| public static final int SIZEOF_DOUBLE | |
| SIZEOF_FLOAT | back to summary |
|---|---|
| public static final int SIZEOF_FLOAT | |
| SIZEOF_INT | back to summary |
|---|---|
| public static final int SIZEOF_INT | |
| SIZEOF_LONG | back to summary |
|---|---|
| public static final int SIZEOF_LONG | |
| SIZEOF_SHORT | back to summary |
|---|---|
| public static final int SIZEOF_SHORT | |
| Buffers | back to summary |
|---|---|
| protected Buffers() | |
| copyByteBuffer | back to summary |
|---|---|
| public static ByteBuffer copyByteBuffer(final ByteBuffer orig) Copies the remaining elements (as defined by
| |
| copyFloatBuffer | back to summary |
|---|---|
| public static FloatBuffer copyFloatBuffer(final FloatBuffer orig) Copies the remaining elements (as defined by
| |
| copyFloatBufferAsByteBuffer | back to summary |
|---|---|
| public static ByteBuffer copyFloatBufferAsByteBuffer(final FloatBuffer orig) Copies the remaining elements (as defined by
| |
| copyIntBuffer | back to summary |
|---|---|
| public static IntBuffer copyIntBuffer(final IntBuffer orig) Copies the remaining elements (as defined by
| |
| copyIntBufferAsByteBuffer | back to summary |
|---|---|
| public static ByteBuffer copyIntBufferAsByteBuffer(final IntBuffer orig) Copies the remaining elements (as defined by
| |
| copyShortBuffer | back to summary |
|---|---|
| public static ShortBuffer copyShortBuffer(final ShortBuffer orig) Copies the remaining elements (as defined by
| |
| copyShortBufferAsByteBuffer | back to summary |
|---|---|
| public static ByteBuffer copyShortBufferAsByteBuffer(final ShortBuffer orig) Copies the remaining elements (as defined by
| |
| getArray | back to summary |
|---|---|
| public static Object getArray(final Object buf) throws UnsupportedOperationException, IllegalArgumentException Helper routine to return the array backing store reference from a Buffer object.
| |
| getDirectBufferByteOffset | back to summary |
|---|---|
| public static int getDirectBufferByteOffset(final Object buf) Helper routine to get the Buffer byte offset by taking into account the Buffer position and the underlying type. This is the total offset for Direct Buffers. | |
| getDoubleArray | back to summary |
|---|---|
public static double[] getDoubleArray(final float[] source, final int soffset, double[] dest, int doffset, int len)
| |
| getDoubleBuffer | back to summary |
|---|---|
| public static DoubleBuffer getDoubleBuffer(final FloatBuffer source, DoubleBuffer dest) No rewind or repositioning is performed.
| |
| getFloatArray | back to summary |
|---|---|
public static float[] getFloatArray(final double[] source, final int soffset, float[] dest, int doffset, int len)
| |
| getFloatBuffer | back to summary |
|---|---|
| public static FloatBuffer getFloatBuffer(final DoubleBuffer source, FloatBuffer dest) No rewind or repositioning is performed.
| |
| getIndirectBufferByteOffset | back to summary |
|---|---|
| public static int getIndirectBufferByteOffset(final Object buf) Helper routine to get the full byte offset from the beginning of the array that is the storage for the indirect Buffer object. The array offset also includes the position offset within the buffer, in addition to any array offset. | |
| isDirect | back to summary |
|---|---|
| public static boolean isDirect(final Object buf) Helper routine to tell whether a buffer is direct or not. Null pointers are considered direct. | |
| nativeOrder | back to summary |
|---|---|
| public static ByteBuffer nativeOrder(final ByteBuffer buf) Helper routine to set a ByteBuffer to the native byte order, if that operation is supported by the underlying NIO implementation. | |
| newDirectByteBuffer | back to summary |
|---|---|
| public static ByteBuffer newDirectByteBuffer(final int numElements) Allocates a new direct ByteBuffer with the specified number of elements. The returned buffer will have its byte order set to the host platform's native byte order. | |
| newDirectByteBuffer | back to summary |
|---|---|
| public static ByteBuffer newDirectByteBuffer(final byte[] values, final int offset, final int length) | |
| newDirectByteBuffer | back to summary |
|---|---|
| public static ByteBuffer newDirectByteBuffer(final byte[] values, final int offset) | |
| newDirectByteBuffer | back to summary |
|---|---|
| public static ByteBuffer newDirectByteBuffer(final byte[] values) | |
| newDirectCharBuffer | back to summary |
|---|---|
| public static CharBuffer newDirectCharBuffer(final int numElements) Allocates a new direct CharBuffer with the specified number of elements. The returned buffer will have its byte order set to the host platform's native byte order. | |
| newDirectCharBuffer | back to summary |
|---|---|
| public static CharBuffer newDirectCharBuffer(final char[] values, final int offset, final int length) | |
| newDirectCharBuffer | back to summary |
|---|---|
| public static CharBuffer newDirectCharBuffer(final char[] values, final int offset) | |
| newDirectCharBuffer | back to summary |
|---|---|
| public static CharBuffer newDirectCharBuffer(final char[] values) | |
| newDirectDoubleBuffer | back to summary |
|---|---|
| public static DoubleBuffer newDirectDoubleBuffer(final int numElements) Allocates a new direct DoubleBuffer with the specified number of elements. The returned buffer will have its byte order set to the host platform's native byte order. | |
| newDirectDoubleBuffer | back to summary |
|---|---|
| public static DoubleBuffer newDirectDoubleBuffer(final double[] values, final int offset, final int length) | |
| newDirectDoubleBuffer | back to summary |
|---|---|
| public static DoubleBuffer newDirectDoubleBuffer(final double[] values, final int offset) | |
| newDirectDoubleBuffer | back to summary |
|---|---|
| public static DoubleBuffer newDirectDoubleBuffer(final double[] values) | |
| newDirectFloatBuffer | back to summary |
|---|---|
| public static FloatBuffer newDirectFloatBuffer(final int numElements) Allocates a new direct FloatBuffer with the specified number of elements. The returned buffer will have its byte order set to the host platform's native byte order. | |
| newDirectFloatBuffer | back to summary |
|---|---|
| public static FloatBuffer newDirectFloatBuffer(final float[] values, final int offset, final int length) | |
| newDirectFloatBuffer | back to summary |
|---|---|
| public static FloatBuffer newDirectFloatBuffer(final float[] values, final int offset) | |
| newDirectFloatBuffer | back to summary |
|---|---|
| public static FloatBuffer newDirectFloatBuffer(final float[] values) | |
| newDirectIntBuffer | back to summary |
|---|---|
| public static IntBuffer newDirectIntBuffer(final int numElements) Allocates a new direct IntBuffer with the specified number of elements. The returned buffer will have its byte order set to the host platform's native byte order. | |
| newDirectIntBuffer | back to summary |
|---|---|
| public static IntBuffer newDirectIntBuffer(final int[] values, final int offset, final int length) | |
| newDirectIntBuffer | back to summary |
|---|---|
| public static IntBuffer newDirectIntBuffer(final int[] values, final int offset) | |
| newDirectIntBuffer | back to summary |
|---|---|
| public static IntBuffer newDirectIntBuffer(final int[] values) | |
| newDirectLongBuffer | back to summary |
|---|---|
| public static LongBuffer newDirectLongBuffer(final int numElements) Allocates a new direct LongBuffer with the specified number of elements. The returned buffer will have its byte order set to the host platform's native byte order. | |
| newDirectLongBuffer | back to summary |
|---|---|
| public static LongBuffer newDirectLongBuffer(final long[] values, final int offset, final int length) | |
| newDirectLongBuffer | back to summary |
|---|---|
| public static LongBuffer newDirectLongBuffer(final long[] values, final int offset) | |
| newDirectLongBuffer | back to summary |
|---|---|
| public static LongBuffer newDirectLongBuffer(final long[] values) | |
| newDirectShortBuffer | back to summary |
|---|---|
| public static ShortBuffer newDirectShortBuffer(final int numElements) Allocates a new direct ShortBuffer with the specified number of elements. The returned buffer will have its byte order set to the host platform's native byte order. | |
| newDirectShortBuffer | back to summary |
|---|---|
| public static ShortBuffer newDirectShortBuffer(final short[] values, final int offset, final int length) | |
| newDirectShortBuffer | back to summary |
|---|---|
| public static ShortBuffer newDirectShortBuffer(final short[] values, final int offset) | |
| newDirectShortBuffer | back to summary |
|---|---|
| public static ShortBuffer newDirectShortBuffer(final short[] values) | |
| put | back to summary |
|---|---|
public static <B extends Buffer> B put(final B dest, final Buffer src)
| |
| putb | back to summary |
|---|---|
public static <B extends Buffer> B putb(final B dest, final byte v)
| |
| putd | back to summary |
|---|---|
public static <B extends Buffer> B putd(final B dest, final double v)
| |
| putf | back to summary |
|---|---|
public static <B extends Buffer> B putf(final B dest, final float v)
| |
| puti | back to summary |
|---|---|
public static <B extends Buffer> B puti(final B dest, final int v)
| |
| putNb | back to summary |
|---|---|
| public static <B extends Buffer> B putNb(final B dest, final boolean dSigned, final byte v, final boolean sSigned) Store byte source value in given buffer after normalizing it to the destination value range considering signed and unsigned source and destination representation.
| |
| putNf | back to summary |
|---|---|
| public static <B extends Buffer> B putNf(final B dest, final boolean dSigned, final float v) Store float source value in given buffer after normalizing it to the destination value range considering signed and unsigned destination representation.
| |
| putNi | back to summary |
|---|---|
| public static <B extends Buffer> B putNi(final B dest, final boolean dSigned, final int v, final boolean sSigned) Store short source value in given buffer after normalizing it to the destination value range considering signed and unsigned source and destination representation.
| |
| putNs | back to summary |
|---|---|
| public static <B extends Buffer> B putNs(final B dest, final boolean dSigned, final short v, final boolean sSigned) Store short source value in given buffer after normalizing it to the destination value range considering signed and unsigned source and destination representation.
| |
| puts | back to summary |
|---|---|
public static <B extends Buffer> B puts(final B dest, final short v)
| |
| rangeCheck | back to summary |
|---|---|
| public static void rangeCheck(final byte[] array, final int offset, final int minElementsRemaining) | |
| rangeCheck | back to summary |
|---|---|
| public static void rangeCheck(final char[] array, final int offset, final int minElementsRemaining) | |
| rangeCheck | back to summary |
|---|---|
| public static void rangeCheck(final short[] array, final int offset, final int minElementsRemaining) | |
| rangeCheck | back to summary |
|---|---|
| public static void rangeCheck(final int[] array, final int offset, final int minElementsRemaining) | |
| rangeCheck | back to summary |
|---|---|
| public static void rangeCheck(final long[] array, final int offset, final int minElementsRemaining) | |
| rangeCheck | back to summary |
|---|---|
| public static void rangeCheck(final float[] array, final int offset, final int minElementsRemaining) | |
| rangeCheck | back to summary |
|---|---|
| public static void rangeCheck(final double[] array, final int offset, final int minElementsRemaining) | |
| rangeCheck | back to summary |
|---|---|
| public static void rangeCheck(final Buffer buffer, final int minElementsRemaining) | |
| rangeCheckBytes | back to summary |
|---|---|
public static void rangeCheckBytes(final Object buffer, final int minBytesRemaining) throws IllegalArgumentException, IndexOutOfBoundsException
| |
| remainingBytes | back to summary |
|---|---|
| public static int remainingBytes(final Object buffer) throws IllegalArgumentException Returns the number of remaining bytes of the given anonymous
| |
| remainingElem | back to summary |
|---|---|
| public static int remainingElem(final Object buffer) throws IllegalArgumentException Returns the number of remaining elements of the given anonymous
| |
| sizeOfBufferElem | back to summary |
|---|---|
| public static int sizeOfBufferElem(final Object buffer) Returns the size of a single element of the given buffer in bytes
or | |
| slice | back to summary |
|---|---|
| public static <B extends Buffer> B slice(final B buffer) Calls slice on the specified buffer while maintaining the byteorder.
| |
| slice | back to summary |
|---|---|
| public static <B extends Buffer> B slice(final B buffer, final int offset, final int size) Slices the specified buffer with offset as position and offset+size as limit while maintaining the byteorder. Concurrency warning: this method changes the buffers position and limit but will restore it before return. | |
| slice2Float | back to summary |
|---|---|
| public static final FloatBuffer slice2Float(final Buffer buf, final int floatStartPos, final int floatSize) Slices a ByteBuffer or a FloatBuffer to a FloatBuffer at the given position with the given size in float-space. The returned sliced buffer's start position is always zero.
The returned sliced buffer is Using a ByteBuffer as the source guarantees keeping the source native order programmatically. This works around Honeycomb / Android 3.0 Issue 16434. This bug is resolved at least in Android 3.2.
| |
| slice2Float | back to summary |
|---|---|
| public static final FloatBuffer slice2Float(final float[] backing, final int floatStartPos, final int floatSize) Slices a primitive float backing array to a FloatBuffer at the given position with the given size
in float-space by
Due to
The returned sliced buffer is
| |
| toString | back to summary |
|---|---|
| public static StringBuilder toString(StringBuilder sb, final String f, final Buffer buffer) Appends Buffer details inclusive data to a StringBuilder instance.
| |