Package com.pnfsoftware.jeb.util.io
Class ByteArray
java.lang.Object
com.pnfsoftware.jeb.util.io.ByteArray
Primitive reader for little-endian byte arrays. Support for fixed-length primitive
and variable-length LEB128-encoded primitives.
A max bound (see maxPosition()
) can be set on the array. It can be be adjusted at any
time after object creation. When a max bound is set, reading past that bound will generate a
runtime exception. The bound is always relative to the full array length.
-
Constructor Summary
ConstructorsConstructorDescriptionByteArray
(byte[] bytes) Create a little-endianbyte[]
reader with an initial index of 0.ByteArray
(byte[] bytes, int pos) Create a little-endianbyte[]
reader with the provided initial index.ByteArray
(byte[] bytes, int pos, int maxpos) Create a little-endianbyte[]
reader with the provided initial and maximum positions. -
Method Summary
Modifier and TypeMethodDescriptionint
byte[]
bytes()
copy()
copy
(int index) copy
(int index, int maxindex) byte
get()
byte[]
get
(int cnt) int
i16()
int
i32()
long
i64()
int
i8()
int
int
maxPosition
(int pos) int
position()
int
position
(int pos) void
skip
(int cnt) toString()
int
u16()
int
u31()
long
u32()
long
u63()
int
u8()
int
vari32()
long
vari64()
int
varu16()
long
varu32()
-
Constructor Details
-
ByteArray
public ByteArray(byte[] bytes) Create a little-endianbyte[]
reader with an initial index of 0.- Parameters:
bytes
-
-
ByteArray
public ByteArray(byte[] bytes, int pos) Create a little-endianbyte[]
reader with the provided initial index.- Parameters:
bytes
-pos
-
-
ByteArray
public ByteArray(byte[] bytes, int pos, int maxpos) Create a little-endianbyte[]
reader with the provided initial and maximum positions.- Parameters:
bytes
-pos
-maxpos
-
-
-
Method Details
-
copy
-
copy
-
copy
-
bytes
public byte[] bytes() -
position
public int position(int pos) -
position
public int position() -
maxPosition
public int maxPosition(int pos) -
maxPosition
public int maxPosition() -
available
public int available() -
skip
public void skip(int cnt) -
get
public byte get() -
get
public byte[] get(int cnt) -
i8
public int i8() -
u8
public int u8() -
i16
public int i16() -
u16
public int u16() -
u31
public int u31() -
i32
public int i32() -
u32
public long u32() -
u63
public long u63() -
i64
public long i64() -
varu16
public int varu16() -
vari32
public int vari32() -
varu32
public long varu32() -
vari64
public long vari64() -
toString
-