com.alexkasko.unsafe.bytearray
class BitShiftLittleEndianByteArrayTool extends ByteArrayTool
ByteArrayTool using bits shifting and standard
byte array operations.| Constructor and Description |
|---|
BitShiftLittleEndianByteArrayTool() |
| Modifier and Type | Method and Description |
|---|---|
void |
copy(byte[] input,
int inputIndex,
byte[] output,
int outputIndex,
int length)
Copies part of one array into another.
|
byte |
getByte(byte[] data,
int offset)
Gets byte
|
int |
getInt(byte[] data,
int offset)
Gets four bytes as int
|
long |
getLong(byte[] data,
int offset)
Gets long
|
short |
getShort(byte[] data,
int offset)
Gets two bytes as short
|
short |
getUnsignedByte(byte[] data,
int offset)
Gets one byte (stored as one signed byte), converts it to unsigned
and returns it as short
|
long |
getUnsignedInt(byte[] data,
int offset)
Gets unsigned int (stored as 4 bytes) and returns it as long
|
int |
getUnsignedShort(byte[] data,
int offset)
Gets unsigned short (stored as two bytes) and returns it as int
|
boolean |
isUnsafe()
Whether current tool instance uses
sun.misc.Unsafe |
void |
putByte(byte[] data,
int offset,
byte value)
Puts byte
|
void |
putInt(byte[] data,
int offset,
int value)
Puts int as four bytes
|
void |
putLong(byte[] data,
int offset,
long value)
Puts long as eight bytes
|
void |
putShort(byte[] data,
int offset,
short value)
Puts short as two bytes
|
void |
putUnsignedByte(byte[] data,
int offset,
short value)
Puts short with value from 0 to 255 inclusive into byte array as one
signed byte
|
void |
putUnsignedInt(byte[] data,
int offset,
long value)
Puts long value from 0 to 4294967295 inclusive as four bytes
|
void |
putUnsignedShort(byte[] data,
int offset,
int value)
Puts int with value from 0 to 65535 inclusive as two bytes
|
bitshift, get, unsafeBitShiftLittleEndianByteArrayTool()
public boolean isUnsafe()
sun.misc.UnsafeisUnsafe in class ByteArrayToolpublic byte getByte(byte[] data, int offset)
getByte in class ByteArrayTooldata - byte arrayoffset - byte array indexpublic void putByte(byte[] data, int offset, byte value)
putByte in class ByteArrayTooldata - byte arrayoffset - byte array indexvalue - valuepublic short getUnsignedByte(byte[] data, int offset)
getUnsignedByte in class ByteArrayTooldata - byte arrayoffset - byte array indexpublic void putUnsignedByte(byte[] data, int offset, short value)
putUnsignedByte in class ByteArrayTooldata - byte arrayoffset - byte array indexvalue - unsigned bytepublic short getShort(byte[] data, int offset)
getShort in class ByteArrayTooldata - byte arrayoffset - byte array offsetpublic void putShort(byte[] data, int offset, short value)
putShort in class ByteArrayTooldata - byte arrayoffset - byte array offsetvalue - short valuepublic int getUnsignedShort(byte[] data, int offset)
getUnsignedShort in class ByteArrayTooldata - byte arrayoffset - byte array offsetpublic void putUnsignedShort(byte[] data, int offset, int value)
putUnsignedShort in class ByteArrayTooldata - byte arrayoffset - byte array offsetvalue - unsigned short as intpublic int getInt(byte[] data, int offset)
getInt in class ByteArrayTooldata - byte arrayoffset - byte array offsetpublic void putInt(byte[] data, int offset, int value)
putInt in class ByteArrayTooldata - byte arrayoffset - byte array offsetvalue - int valuepublic long getUnsignedInt(byte[] data, int offset)
getUnsignedInt in class ByteArrayTooldata - byte arrayoffset - byte array offsetpublic void putUnsignedInt(byte[] data, int offset, long value)
putUnsignedInt in class ByteArrayTooldata - byte arrayoffset - byte array offsetvalue - unsigned int as longpublic long getLong(byte[] data, int offset)
getLong in class ByteArrayTooldata - byte arrayoffset - byte array offsetpublic void putLong(byte[] data, int offset, long value)
putLong in class ByteArrayTooldata - byte arrayoffset - byte array offsetvalue - long valuepublic void copy(byte[] input, int inputIndex, byte[] output, int outputIndex, int length)
System.arraycopy(Object, int, Object, int, int)
that is used by fallback implementation usescopy in class ByteArrayToolinput - source arrayinputIndex - source array positionoutput - destination arrayoutputIndex - destination array positionlength - length to copyCopyright © 2014. All Rights Reserved.