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 TypeMethodDescriptionintbyte[]bytes()copy()copy(int index) copy(int index, int maxindex) byteget()byte[]get(int cnt) inti16()inti32()longi64()inti8()intintmaxPosition(int pos) intposition()intposition(int pos) voidskip(int cnt) sub(int len) toString()intu16()intu31()longu32()longu63()intu8()intvari32()longvari64()intvaru16()longvaru32()
-
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
-
sub
-
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
-