public abstract class UnsignedBuffer extends Object
Buffer
.
This class exists as Java does not supported unsigned primitive types (apart from char), so it is necessary to explicitly convert an unsigned primitive type to a larger primitive type for arithmetic operations (e.g. unsigned bytes need to be converted to short or higher, unsigned shorts to int or higher, unsigned int to long or higher).
Subclasses must define a sensible Object.equals(java.lang.Object)
and Object.hashCode()
that takes
account the delegate buffer.
Constructor and Description |
---|
UnsignedBuffer(Buffer delegate) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
canEqual(Object other) |
int |
capacity()
The capacity of the buffer ala
Buffer.capacity . |
void |
clear()
Clears the buffer ala
Buffer.clear() . |
boolean |
equals(Object o) |
boolean |
hasArray()
Whether the buffer has an array?
|
int |
hashCode() |
boolean |
hasRemaining()
Whether there are elements between the current position and the limit
Buffer.hasRemaining() . |
boolean |
isDirect()
Is this buffer direct or non-direct?
|
int |
position()
The position of the buffer ala
Buffer.position . |
Buffer |
position(int newPosition)
Assigns a new position to the buffer.
|
abstract void |
putDouble(double value)
Puts a double at the current buffer position.
|
abstract void |
putDouble(int index,
double value)
Puts a double at a particular buffer position.
|
abstract void |
putFloat(float value)
Puts a float at the current buffer position.
|
abstract void |
putFloat(int index,
float value)
Puts a float at a particular buffer position.
|
abstract void |
putLong(long value)
Puts a long at the current buffer position.
|
public UnsignedBuffer(Buffer delegate)
public abstract void putFloat(float value)
A conversion occurs from float to short.
value
- the float.public abstract void putFloat(int index, float value)
A conversion occurs from float to byte.
index
- the buffer positionvalue
- the float.public abstract void putDouble(double value)
value
- the doublepublic abstract void putDouble(int index, double value)
index
- the buffer positionvalue
- the doublepublic abstract void putLong(long value)
value
- the long.public final boolean hasRemaining()
Buffer.hasRemaining()
.public final int position()
Buffer.position
.public final Buffer position(int newPosition)
This is meant in the sense of Java's NIO Buffer
classes.
newPosition
- the index to assign as position.public final int capacity()
Buffer.capacity
.public final void clear()
Buffer.clear()
.public boolean isDirect()
This is meant in the sense of Java's NIO Buffer
classes.
public boolean hasArray()
This is meant in the sense of Java's NIO Buffer
classes.
protected boolean canEqual(Object other)
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.