public abstract class UnsafeArrayTypeReader extends Object implements TypeReader
supportsUnalignedMemoryAccess
must be set according to the capabilities of the
hardware architecture: the value true
allows more efficient memory access on
architectures that support unaligned memory accesses; the value false
is the safe
fallback that works on every hardware.Modifier and Type | Field and Description |
---|---|
protected long |
byteIndex |
protected byte[] |
data |
Modifier | Constructor and Description |
---|---|
protected |
UnsafeArrayTypeReader(byte[] data,
long byteIndex) |
Modifier and Type | Method and Description |
---|---|
static UnsafeArrayTypeReader |
create(byte[] data,
long byteIndex,
boolean supportsUnalignedMemoryAccess) |
long |
getByteIndex()
Returns the next byte index to be read.
|
int |
getS1()
Reads a signed 1 byte value.
|
static int |
getS1(byte[] data,
long byteIndex) |
static int |
getS2(byte[] data,
long byteIndex,
boolean supportsUnalignedMemoryAccess) |
static int |
getS4(byte[] data,
long byteIndex,
boolean supportsUnalignedMemoryAccess) |
static long |
getS8(byte[] data,
long byteIndex,
boolean supportsUnalignedMemoryAccess) |
int |
getU1()
Reads an unsigned 1 byte value.
|
static int |
getU1(byte[] data,
long byteIndex) |
int |
getU2()
Reads an unsigned 2 byte value.
|
static int |
getU2(byte[] data,
long byteIndex,
boolean supportsUnalignedMemoryAccess) |
long |
getU4()
Reads an unsigned 4 byte value.
|
static long |
getU4(byte[] data,
long byteIndex,
boolean supportsUnalignedMemoryAccess) |
protected static long |
readOffset(byte[] data,
long byteIndex,
int numBytes) |
void |
setByteIndex(long byteIndex)
Sets the next byte index to be read.
|
protected UnsafeArrayTypeReader(byte[] data, long byteIndex)
public static int getS1(byte[] data, long byteIndex)
public static int getU1(byte[] data, long byteIndex)
public static int getS2(byte[] data, long byteIndex, boolean supportsUnalignedMemoryAccess)
public static int getU2(byte[] data, long byteIndex, boolean supportsUnalignedMemoryAccess)
public static int getS4(byte[] data, long byteIndex, boolean supportsUnalignedMemoryAccess)
public static long getU4(byte[] data, long byteIndex, boolean supportsUnalignedMemoryAccess)
public static long getS8(byte[] data, long byteIndex, boolean supportsUnalignedMemoryAccess)
protected static long readOffset(byte[] data, long byteIndex, int numBytes)
public static UnsafeArrayTypeReader create(byte[] data, long byteIndex, boolean supportsUnalignedMemoryAccess)
public long getByteIndex()
TypeReader
getByteIndex
in interface TypeReader
public void setByteIndex(long byteIndex)
TypeReader
setByteIndex
in interface TypeReader
public final int getS1()
TypeReader
getS1
in interface TypeReader
public final int getU1()
TypeReader
getU1
in interface TypeReader
public final int getU2()
TypeReader
getU2
in interface TypeReader
public final long getU4()
TypeReader
getU4
in interface TypeReader