public abstract class ByteArraySupport extends Object
ByteArraySupport.littleEndian()
or ByteArraySupport.bigEndian()
respectively to access byte arrays in
little-endian or big-endian order.
The methods of this class are not safe for use by multiple concurrent threads, unless otherwise stated. If a byte array is to be used by more than one thread then access to the byte array should be controlled by appropriate synchronization.
Unaligned accesses are allowed.
Modifier and Type | Method and Description |
---|---|
static ByteArraySupport |
bigEndian()
Enables accessing multibyte Java primitives from byte arrays in big-endian order.
|
abstract byte |
compareAndExchangeByte(byte[] buffer,
long byteOffset,
byte expected,
byte x)
Atomically exchanges the given byte with the current byte at the given byte offset from the
start of the buffer, if and only if the current byte equals the expected byte.
|
abstract int |
compareAndExchangeInt(byte[] buffer,
long byteOffset,
int expected,
int x)
Atomically exchanges the given int with the current int at the given byte offset from the
start of the buffer, if and only if the current int equals the expected int.
|
abstract long |
compareAndExchangeLong(byte[] buffer,
long byteOffset,
long expected,
long x)
Atomically exchanges the given long with the current long at the given byte offset from the
start of the buffer, if and only if the current long equals the expected long.
|
abstract short |
compareAndExchangeShort(byte[] buffer,
long byteOffset,
short expected,
short x)
Atomically exchanges the given short with the current short at the given byte offset from the
start of the buffer, if and only if the current short equals the expected short.
|
abstract byte |
getAndAddByte(byte[] buffer,
long byteOffset,
byte delta)
Atomically adds the given byte to the current byte at the given byte offset from the start of
the buffer.
|
abstract int |
getAndAddInt(byte[] buffer,
long byteOffset,
int delta)
Atomically adds the given int to the current int at the given byte offset from the start of
the buffer.
|
abstract long |
getAndAddLong(byte[] buffer,
long byteOffset,
long delta)
Atomically adds the given long to the current long at the given byte offset from the start of
the buffer.
|
abstract short |
getAndAddShort(byte[] buffer,
long byteOffset,
short delta)
Atomically adds the given short to the current short at the given byte offset from the start
of the buffer.
|
abstract byte |
getAndBitwiseAndByte(byte[] buffer,
long byteOffset,
byte mask)
Atomically bitwise-ANDs the given byte to the current byte at the given byte offset from the
start of the buffer.
|
abstract int |
getAndBitwiseAndInt(byte[] buffer,
long byteOffset,
int mask)
Atomically bitwise-ANDs the given int to the current int at the given byte offset from the
start of the buffer.
|
abstract long |
getAndBitwiseAndLong(byte[] buffer,
long byteOffset,
long mask)
Atomically bitwise-ANDs the given long to the current long at the given byte offset from the
start of the buffer.
|
abstract short |
getAndBitwiseAndShort(byte[] buffer,
long byteOffset,
short mask)
Atomically bitwise-ANDs the given short to the current short at the given byte offset from
the start of the buffer.
|
abstract byte |
getAndBitwiseOrByte(byte[] buffer,
long byteOffset,
byte mask)
Atomically bitwise-ORs the given byte to the current byte at the given byte offset from the
start of the buffer.
|
abstract int |
getAndBitwiseOrInt(byte[] buffer,
long byteOffset,
int mask)
Atomically bitwise-ORs the given int to the current int at the given byte offset from the
start of the buffer.
|
abstract long |
getAndBitwiseOrLong(byte[] buffer,
long byteOffset,
long mask)
Atomically bitwise-ORs the given long to the current long at the given byte offset from the
start of the buffer.
|
abstract short |
getAndBitwiseOrShort(byte[] buffer,
long byteOffset,
short mask)
Atomically bitwise-ORs the given short to the current short at the given byte offset from the
start of the buffer.
|
abstract byte |
getAndBitwiseXorByte(byte[] buffer,
long byteOffset,
byte mask)
Atomically bitwise-XORs the given byte to the current byte at the given byte offset from the
start of the buffer.
|
abstract int |
getAndBitwiseXorInt(byte[] buffer,
long byteOffset,
int mask)
Atomically bitwise-XORs the given int to the current int at the given byte offset from the
start of the buffer.
|
abstract long |
getAndBitwiseXorLong(byte[] buffer,
long byteOffset,
long mask)
Atomically bitwise-XORs the given long to the current long at the given byte offset from the
start of the buffer.
|
abstract short |
getAndBitwiseXorShort(byte[] buffer,
long byteOffset,
short mask)
Atomically bitwise-XORs the given short to the current short at the given byte offset from
the start of the buffer.
|
abstract byte |
getAndSetByte(byte[] buffer,
long byteOffset,
byte newValue)
Atomically exchanges the given byte with the current byte at the given byte offset from the
start of the buffer.
|
abstract int |
getAndSetInt(byte[] buffer,
long byteOffset,
int newValue)
Atomically exchanges the given int with the current int at the given byte offset from the
start of the buffer.
|
abstract long |
getAndSetLong(byte[] buffer,
long byteOffset,
long newValue)
Atomically exchanges the given long with the current long at the given byte offset from the
start of the buffer.
|
abstract short |
getAndSetShort(byte[] buffer,
long byteOffset,
short newValue)
Atomically exchanges the given short with the current short at the given byte offset from the
start of the buffer.
|
abstract byte |
getByte(byte[] buffer,
int byteOffset)
Reads the byte at the given byte offset from the start of the buffer.
|
abstract byte |
getByte(byte[] buffer,
long byteOffset)
Reads the byte at the given byte offset from the start of the buffer.
|
abstract byte |
getByteVolatile(byte[] buffer,
long byteOffset)
Volatile version of
ByteArraySupport.getByte(byte[], long) . |
abstract double |
getDouble(byte[] buffer,
int byteOffset)
Reads the double at the given byte offset from the start of the buffer.
|
abstract double |
getDouble(byte[] buffer,
long byteOffset)
Reads the double at the given byte offset from the start of the buffer.
|
abstract float |
getFloat(byte[] buffer,
int byteOffset)
Reads the float at the given byte offset from the start of the buffer.
|
abstract float |
getFloat(byte[] buffer,
long byteOffset)
Reads the float at the given byte offset from the start of the buffer.
|
abstract int |
getInt(byte[] buffer,
int byteOffset)
Reads the int at the given byte offset from the start of the buffer.
|
abstract int |
getInt(byte[] buffer,
long byteOffset)
Reads the int at the given byte offset from the start of the buffer.
|
abstract int |
getIntVolatile(byte[] buffer,
long byteOffset)
Volatile version of
ByteArraySupport.getInt(byte[], long) . |
abstract long |
getLong(byte[] buffer,
int byteOffset)
Reads the long at the given byte offset from the start of the buffer.
|
abstract long |
getLong(byte[] buffer,
long byteOffset)
Reads the long at the given byte offset from the start of the buffer.
|
abstract long |
getLongVolatile(byte[] buffer,
long byteOffset)
Volatile version of
ByteArraySupport.getLong(byte[], long) . |
abstract short |
getShort(byte[] buffer,
int byteOffset)
Reads the short at the given byte offset from the start of the buffer.
|
abstract short |
getShort(byte[] buffer,
long byteOffset)
Reads the short at the given byte offset from the start of the buffer.
|
abstract short |
getShortVolatile(byte[] buffer,
long byteOffset)
Volatile version of
ByteArraySupport.getShort(byte[], long) . |
boolean |
inBounds(byte[] buffer,
int startByteOffset,
int length)
Checks if an access is in bounds of the given buffer.
|
boolean |
inBounds(byte[] buffer,
long startByteOffset,
long length)
Checks if an access is in bounds of the given buffer.
|
static ByteArraySupport |
littleEndian()
Enables accessing multibyte Java primitives from byte arrays in little-endian order.
|
abstract void |
putByte(byte[] buffer,
int byteOffset,
byte value)
Writes the given byte at the given byte offset from the start of the buffer.
|
abstract void |
putByte(byte[] buffer,
long byteOffset,
byte value)
Writes the given byte at the given byte offset from the start of the buffer.
|
abstract void |
putByteVolatile(byte[] buffer,
long byteOffset,
byte value)
Volatile version of
ByteArraySupport.putByte(byte[], long, byte) . |
abstract void |
putDouble(byte[] buffer,
int byteOffset,
double value)
Writes the given double at the given byte offset from the start of the buffer.
|
abstract void |
putDouble(byte[] buffer,
long byteOffset,
double value)
Writes the given double at the given byte offset from the start of the buffer.
|
abstract void |
putFloat(byte[] buffer,
int byteOffset,
float value)
Writes the given float at the given byte offset from the start of the buffer.
|
abstract void |
putFloat(byte[] buffer,
long byteOffset,
float value)
Writes the given float at the given byte offset from the start of the buffer.
|
abstract void |
putInt(byte[] buffer,
int byteOffset,
int value)
Writes the given int at the given byte offset from the start of the buffer.
|
abstract void |
putInt(byte[] buffer,
long byteOffset,
int value)
Writes the given int at the given byte offset from the start of the buffer.
|
abstract void |
putIntVolatile(byte[] buffer,
long byteOffset,
int value)
Volatile version of
ByteArraySupport.putInt(byte[], long, int) . |
abstract void |
putLong(byte[] buffer,
int byteOffset,
long value)
Writes the given long at the given byte offset from the start of the buffer.
|
abstract void |
putLong(byte[] buffer,
long byteOffset,
long value)
Writes the given long at the given byte offset from the start of the buffer.
|
abstract void |
putLongVolatile(byte[] buffer,
long byteOffset,
long value)
Volatile version of
ByteArraySupport.putLong(byte[], long, long) . |
abstract void |
putShort(byte[] buffer,
int byteOffset,
short value)
Writes the given short at the given byte offset from the start of the buffer.
|
abstract void |
putShort(byte[] buffer,
long byteOffset,
short value)
Writes the given short at the given byte offset from the start of the buffer.
|
abstract void |
putShortVolatile(byte[] buffer,
long byteOffset,
short value)
Volatile version of
ByteArraySupport.putShort(byte[], long, short) . |
public static ByteArraySupport littleEndian()
Example usage:
byte[] buffer = new byte[]{0, 0, 0, 0};
ByteArraySupport.littleEndian().putShort(buffer, 2, (short) 1);
// buffer[2] == (byte) 1
// buffer[3] == (byte) 0
ByteArraySupport.littleEndian().putShort(buffer, 3, (short) 1);
// throws IndexOutOfBoundsException exception
public static ByteArraySupport bigEndian()
Example usage:
byte[] buffer = new byte[]{0, 0, 0, 0};
ByteArraySupport.bigEndian().putShort(buffer, 0, (short) 1);
// buffer[0] == (byte) 0
// buffer[1] == (byte) 1
public final boolean inBounds(byte[] buffer, int startByteOffset, int length)
If out-of-bounds accesses are expected to happen frequently, it is faster (~1.2x in
interpreter mode) to use this method to check for them than catching
IndexOutOfBoundsException
s.
buffer
- the byte arraystartByteOffset
- the start byte offset of the accesslength
- the number of bytes accessedpublic final boolean inBounds(byte[] buffer, long startByteOffset, long length)
If out-of-bounds accesses are expected to happen frequently, it is faster (~1.2x in
interpreter mode) to use this method to check for them than catching
IndexOutOfBoundsException
s.
buffer
- the byte arraystartByteOffset
- the start byte offset of the accesslength
- the number of bytes accessedpublic abstract byte getByte(byte[] buffer, int byteOffset) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the byte will be readIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length
public abstract byte getByte(byte[] buffer, long byteOffset) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the byte will be readIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length
public abstract void putByte(byte[] buffer, int byteOffset, byte value) throws IndexOutOfBoundsException
buffer
- the byte array to write inbyteOffset
- the byte offset at which the byte will be writtenvalue
- the byte value to be writtenIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length
public abstract void putByte(byte[] buffer, long byteOffset, byte value) throws IndexOutOfBoundsException
buffer
- the byte array to write inbyteOffset
- the byte offset at which the byte will be writtenvalue
- the byte value to be writtenIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length
public abstract short getShort(byte[] buffer, int byteOffset) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset from which the short will be readIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 1
public abstract short getShort(byte[] buffer, long byteOffset) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset from which the short will be readIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 1
public abstract void putShort(byte[] buffer, int byteOffset, short value) throws IndexOutOfBoundsException
buffer
- the byte array to write inbyteOffset
- the byte offset from which the short will be writtenvalue
- the short value to be writtenIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 1
public abstract void putShort(byte[] buffer, long byteOffset, short value) throws IndexOutOfBoundsException
buffer
- the byte array to write inbyteOffset
- the byte offset from which the short will be writtenvalue
- the short value to be writtenIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 1
public abstract int getInt(byte[] buffer, int byteOffset) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset from which the int will be readIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 3
public abstract int getInt(byte[] buffer, long byteOffset) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset from which the int will be readIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 3
public abstract void putInt(byte[] buffer, int byteOffset, int value) throws IndexOutOfBoundsException
buffer
- the byte array to write inbyteOffset
- the byte offset from which the int will be writtenvalue
- the int value to be writtenIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 3
public abstract void putInt(byte[] buffer, long byteOffset, int value) throws IndexOutOfBoundsException
buffer
- the byte array to write inbyteOffset
- the byte offset from which the int will be writtenvalue
- the int value to be writtenIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 3
public abstract long getLong(byte[] buffer, int byteOffset) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset from which the int will be readIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 7
public abstract long getLong(byte[] buffer, long byteOffset) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset from which the int will be readIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 7
public abstract void putLong(byte[] buffer, int byteOffset, long value) throws IndexOutOfBoundsException
buffer
- the byte array to write inbyteOffset
- the byte offset from which the int will be writtenvalue
- the int value to be writtenIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 7
public abstract void putLong(byte[] buffer, long byteOffset, long value) throws IndexOutOfBoundsException
buffer
- the byte array to write inbyteOffset
- the byte offset from which the int will be writtenvalue
- the int value to be writtenIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 7
public abstract float getFloat(byte[] buffer, int byteOffset) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset from which the float will be readIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 3
public abstract float getFloat(byte[] buffer, long byteOffset) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset from which the float will be readIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 3
public abstract void putFloat(byte[] buffer, int byteOffset, float value) throws IndexOutOfBoundsException
buffer
- the byte array to write inbyteOffset
- the byte offset from which the float will be writtenvalue
- the float value to be writtenIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 3
public abstract void putFloat(byte[] buffer, long byteOffset, float value) throws IndexOutOfBoundsException
buffer
- the byte array to write inbyteOffset
- the byte offset from which the float will be writtenvalue
- the float value to be writtenIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 3
public abstract double getDouble(byte[] buffer, int byteOffset) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset from which the double will be readIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 7
public abstract double getDouble(byte[] buffer, long byteOffset) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset from which the double will be readIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 7
public abstract void putDouble(byte[] buffer, int byteOffset, double value) throws IndexOutOfBoundsException
buffer
- the byte array to write inbyteOffset
- the byte offset from which the double will be writtenvalue
- the double value to be writtenIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 7
public abstract void putDouble(byte[] buffer, long byteOffset, double value) throws IndexOutOfBoundsException
buffer
- the byte array to write inbyteOffset
- the byte offset from which the double will be writtenvalue
- the double value to be writtenIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 7
public abstract byte getByteVolatile(byte[] buffer, long byteOffset) throws IndexOutOfBoundsException
ByteArraySupport.getByte(byte[], long)
.IndexOutOfBoundsException
public abstract void putByteVolatile(byte[] buffer, long byteOffset, byte value) throws IndexOutOfBoundsException
ByteArraySupport.putByte(byte[], long, byte)
.IndexOutOfBoundsException
public abstract short getShortVolatile(byte[] buffer, long byteOffset) throws IndexOutOfBoundsException
ByteArraySupport.getShort(byte[], long)
.IndexOutOfBoundsException
public abstract void putShortVolatile(byte[] buffer, long byteOffset, short value) throws IndexOutOfBoundsException
ByteArraySupport.putShort(byte[], long, short)
.IndexOutOfBoundsException
public abstract int getIntVolatile(byte[] buffer, long byteOffset) throws IndexOutOfBoundsException
ByteArraySupport.getInt(byte[], long)
.IndexOutOfBoundsException
public abstract void putIntVolatile(byte[] buffer, long byteOffset, int value) throws IndexOutOfBoundsException
ByteArraySupport.putInt(byte[], long, int)
.IndexOutOfBoundsException
public abstract long getLongVolatile(byte[] buffer, long byteOffset) throws IndexOutOfBoundsException
ByteArraySupport.getLong(byte[], long)
.IndexOutOfBoundsException
public abstract void putLongVolatile(byte[] buffer, long byteOffset, long value) throws IndexOutOfBoundsException
ByteArraySupport.putLong(byte[], long, long)
.IndexOutOfBoundsException
public abstract byte getAndAddByte(byte[] buffer, long byteOffset, byte delta) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the byte will be read and written todelta
- the byte value to addIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length
public abstract short getAndAddShort(byte[] buffer, long byteOffset, short delta) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the short will be read and written todelta
- the short value to addIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 1
public abstract int getAndAddInt(byte[] buffer, long byteOffset, int delta) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the int will be read and written todelta
- the int value to addIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 3
public abstract long getAndAddLong(byte[] buffer, long byteOffset, long delta) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the long will be read and written todelta
- the long value to addIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 7
public abstract byte getAndBitwiseAndByte(byte[] buffer, long byteOffset, byte mask) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the byte will be read and written tomask
- the byte value to bitwise-ANDIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length
public abstract short getAndBitwiseAndShort(byte[] buffer, long byteOffset, short mask) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the short will be read and written tomask
- the short value to bitwise-ANDIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 1
public abstract int getAndBitwiseAndInt(byte[] buffer, long byteOffset, int mask) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the int will be read and written tomask
- the int value to bitwise-ANDIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 3
public abstract long getAndBitwiseAndLong(byte[] buffer, long byteOffset, long mask) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the long will be read and written tomask
- the long value to bitwise-ANDIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 7
public abstract byte getAndBitwiseOrByte(byte[] buffer, long byteOffset, byte mask) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the byte will be read and written tomask
- the byte value to bitwise-ORIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length
public abstract short getAndBitwiseOrShort(byte[] buffer, long byteOffset, short mask) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the short will be read and written tomask
- the short value to bitwise-ORIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 1
public abstract int getAndBitwiseOrInt(byte[] buffer, long byteOffset, int mask) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the int will be read and written tomask
- the int value to bitwise-ORIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 3
public abstract long getAndBitwiseOrLong(byte[] buffer, long byteOffset, long mask) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the long will be read and written tomask
- the long value to bitwise-ORIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 7
public abstract byte getAndBitwiseXorByte(byte[] buffer, long byteOffset, byte mask) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the byte will be read and written tomask
- the byte value to bitwise-XORIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length
public abstract short getAndBitwiseXorShort(byte[] buffer, long byteOffset, short mask) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the short will be read and written tomask
- the short value to bitwise-XORIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 1
public abstract int getAndBitwiseXorInt(byte[] buffer, long byteOffset, int mask) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the int will be read and written tomask
- the int value to bitwise-XORIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 3
public abstract long getAndBitwiseXorLong(byte[] buffer, long byteOffset, long mask) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the long will be read and written tomask
- the long value to bitwise-XORIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 7
public abstract byte getAndSetByte(byte[] buffer, long byteOffset, byte newValue) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the byte will be read and written tonewValue
- the new byte valueIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length
public abstract short getAndSetShort(byte[] buffer, long byteOffset, short newValue) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the short will be read and written tonewValue
- the new short valueIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 1
public abstract int getAndSetInt(byte[] buffer, long byteOffset, int newValue) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the int will be read and written tonewValue
- the new int valueIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 3
public abstract long getAndSetLong(byte[] buffer, long byteOffset, long newValue) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the long will be read and written tonewValue
- the new long valueIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 7
public abstract byte compareAndExchangeByte(byte[] buffer, long byteOffset, byte expected, byte x) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the byte will be read and written toexpected
- the expected byte valuex
- the replacement byte valueIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length
public abstract short compareAndExchangeShort(byte[] buffer, long byteOffset, short expected, short x) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the short will be read and written toexpected
- the expected short valuex
- the replacement short valueIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 1
public abstract int compareAndExchangeInt(byte[] buffer, long byteOffset, int expected, int x) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the int will be read and written toexpected
- the expected int valuex
- the replacement int valueIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 3
public abstract long compareAndExchangeLong(byte[] buffer, long byteOffset, long expected, long x) throws IndexOutOfBoundsException
buffer
- the byte array to read frombyteOffset
- the byte offset at which the long will be read and written toexpected
- the expected long valuex
- the replacement long valueIndexOutOfBoundsException
- if and only if
byteOffset < 0 || byteOffset >= buffer.length - 7