Class ByteArray

java.lang.Object
com.pnfsoftware.jeb.util.io.ByteArray

public class ByteArray extends Object
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 Details

    • ByteArray

      public ByteArray(byte[] bytes)
      Create a little-endian byte[] reader with an initial index of 0.
      Parameters:
      bytes -
    • ByteArray

      public ByteArray(byte[] bytes, int pos)
      Create a little-endian byte[] reader with the provided initial index.
      Parameters:
      bytes -
      pos -
    • ByteArray

      public ByteArray(byte[] bytes, int pos, int maxpos)
      Create a little-endian byte[] reader with the provided initial and maximum positions.
      Parameters:
      bytes -
      pos -
      maxpos -
  • Method Details

    • copy

      public ByteArray copy()
    • copy

      public ByteArray copy(int index)
    • copy

      public ByteArray copy(int index, int maxindex)
    • 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

      public String toString()
      Overrides:
      toString in class Object