public final class UnsignedIntBuffer extends UnsignedBuffer
IntBuffer
but automatically performs conversion to long
.
The conversion applies to IntBuffer.get()
and IntBuffer.put(int)
of single elements,
but not to any mass get or put operations.
The user has a choice of getting/setting using raw (getRaw()
, putRaw(int)
etc.) or
unsigned-conversion (getUnsigned()
, putUnsigned(long)
etc.) methods. The raw methods
are always more efficient, and so should be preferred when conversion is not needed.
Modifier and Type | Method and Description |
---|---|
static UnsignedIntBuffer |
allocate(int capacity)
Allocates a new (direct) buffer of unsigned-ints.
|
int[] |
array()
The array of the buffer ala
IntBuffer.array() . |
protected boolean |
canEqual(Object other) |
boolean |
equals(Object o) |
IntBuffer |
getDelegate()
The underlying storage buffer, to which calls are delegated with our without conversion.
|
int |
getRaw()
Gets an unsigned-int (represented as an int) at the current buffer position.
|
int |
getRaw(int index)
Gets an unsigned-int (represented as a int) at a particular buffer position.
|
long |
getUnsigned()
Gets an unsigned-int (represented as a long) at the current buffer position.
|
long |
getUnsigned(int index)
Gets an unsigned-int (represented as a long) at a particular buffer position.
|
int |
hashCode() |
void |
putDouble(double value)
Puts a double at the current buffer position.
|
void |
putDouble(int index,
double value)
Puts a double at a particular buffer position.
|
void |
putFloat(float value)
Puts a float at the current buffer position.
|
void |
putFloat(int index,
float value)
Puts a float at a particular buffer position.
|
void |
putLong(long value)
Puts a long at the current buffer position.
|
void |
putRaw(int value)
Puts an unsigned-int (represented as a int) at the current buffer position.
|
void |
putRaw(int index,
int value)
Puts an unsigned-int (represented as a int) a particular buffer position.
|
void |
putUnsigned(int index,
long value)
Puts an unsigned-int (represented as a long) a particular buffer position.
|
void |
putUnsigned(long value)
Puts an unsigned-int (represented by a long) at current buffer position.
|
static UnsignedIntBuffer |
wrapRaw(int[] array)
Exposes a raw int-array as a buffer with unsigned-ints.
|
static UnsignedIntBuffer |
wrapRaw(IntBuffer bufferRaw)
Exposes a raw
UnsignedIntBuffer as a buffer with unsigned-ints. |
capacity, clear, hasArray, hasRemaining, isDirect, position, position
public static UnsignedIntBuffer allocate(int capacity)
capacity
- size of buffer.public static UnsignedIntBuffer wrapRaw(int[] array)
array
- the int-arrayUnsignedIntBuffer
that reuses array
internally.public static UnsignedIntBuffer wrapRaw(IntBuffer bufferRaw)
UnsignedIntBuffer
as a buffer with unsigned-ints.bufferRaw
- the raw-bufferUnsignedIntBuffer
that reuses bufferRaw
internally.public int getRaw()
No further conversion occurs, so this method is more efficient than getUnsigned()
.
public int getRaw(int index)
No further conversion occurs, so this method is more efficient than getUnsigned(int)
.
index
- the buffer positionpublic long getUnsigned()
public long getUnsigned(int index)
index
- the buffer positionpublic void putRaw(int value)
No further conversion occurs, so this method is more efficient than putUnsigned(long)
.
value
- unsigned-int (represented by a int)public void putRaw(int index, int value)
No further conversion occurs, so this method is more efficient than putUnsigned(int,long)
.
index
- the buffer positionvalue
- the unsigned-int (represented by an int)public void putUnsigned(long value)
A conversion occurs from long to int.
value
- the unsigned-int (represented by a long)public void putUnsigned(int index, long value)
A conversion occurs from long to int.
index
- the buffer positionvalue
- the unsigned-int (represented by a long)public void putFloat(float value)
UnsignedBuffer
A conversion occurs from float to short.
putFloat
in class UnsignedBuffer
value
- the float.public void putFloat(int index, float value)
UnsignedBuffer
A conversion occurs from float to byte.
putFloat
in class UnsignedBuffer
index
- the buffer positionvalue
- the float.public void putDouble(double value)
UnsignedBuffer
putDouble
in class UnsignedBuffer
value
- the doublepublic void putDouble(int index, double value)
UnsignedBuffer
putDouble
in class UnsignedBuffer
index
- the buffer positionvalue
- the doublepublic void putLong(long value)
UnsignedBuffer
putLong
in class UnsignedBuffer
value
- the long.public final int[] array()
IntBuffer.array()
.
Unlike IntBuffer.array()
an array will always be returned, copying it into a newly
created array, if it cannot be directly accessed.
public boolean equals(Object o)
equals
in class UnsignedBuffer
protected boolean canEqual(Object other)
canEqual
in class UnsignedBuffer
public int hashCode()
hashCode
in class UnsignedBuffer
public IntBuffer getDelegate()
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.