# Class: 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 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: ByteArray
- parameter: `bytes`, type: `byte[]`

Description: Create a little\-endian `byte[]` reader with an initial index of 0.
parameter: bytes: backing byte array

## Constructor: ByteArray
- parameter: `bytes`, type: `byte[]`
- parameter: `pos`, type: `int`

Description: Create a little\-endian `byte[]` reader with the provided initial index.
parameter: bytes: backing byte array
parameter: pos: initial index

## Constructor: ByteArray
- parameter: `bytes`, type: `byte[]`
- parameter: `pos`, type: `int`
- parameter: `maxpos`, type: `int`

Description: Create a little\-endian `byte[]` reader with the provided initial and maximum positions.
parameter: bytes: backing byte array
parameter: pos: initial index
parameter: maxpos: maximum index

## Method: available
- return type: `int`

Description: 
return: the number of bytes available from the current position to the max position

## Method: bytes
- return type: `byte[]`

Description: 
return: the underlying byte array provided to the constructor

## Method: get
- return type: `byte`

Description: Read one byte.
return: byte at the current position

## Method: get
- parameter: `cnt`, type: `int`
- return type: `byte[]`

Description: Read bytes from the current position.
parameter: cnt: number of bytes to read
return: newly allocated byte array

## Method: i16
- return type: `int`

Description: Read a signed little\-endian 16\-bit integer.
return: decoded value

## Method: i32
- return type: `int`

Description: Read a signed little\-endian 32\-bit integer.
return: decoded value

## Method: i64
- return type: `long`

Description: Read a signed little\-endian 64\-bit integer.
return: decoded value

## Method: i8
- return type: `int`

Description: Read a signed 8\-bit integer.
return: decoded value

## Method: maxPosition
- parameter: `maxpos`, type: `int`
- return type: `int`

Description: 
parameter: maxpos: the new max position \(which cannot be less than the current position\)
return: the previous max position

## Method: maxPosition
- return type: `int`

Description: Get the current maximum readable position.
return: maximum position

## Method: position
- parameter: `pos`, type: `int`
- return type: `int`

Description: 
parameter: pos: the new position \(which cannot be more than the current max position\)
return: the previous position

## Method: position
- return type: `int`

Description: Get the current read position.
return: current position

## Method: skip
- parameter: `cnt`, type: `int`

Description: Advance or rewind the current position.
parameter: cnt: signed byte count to skip

## Method: sub
- parameter: `len`, type: `int`
- return type: `com.pnfsoftware.jeb.util.io.ByteArray`

Description: Create a view of this object.
parameter: len: count of bytes from the current position
return: a new byte array

## Method: toString
- return type: `java.lang.String`


## Method: u16
- return type: `int`

Description: Read an unsigned little\-endian 16\-bit integer.
return: decoded value

## Method: u31
- return type: `int`

Description: Read a non\-negative little\-endian 32\-bit integer.
return: decoded value

## Method: u32
- return type: `long`

Description: Read an unsigned little\-endian 32\-bit integer.
return: decoded value

## Method: u63
- return type: `long`

Description: Read a non\-negative little\-endian 64\-bit integer.
return: decoded value

## Method: u8
- return type: `int`

Description: Read an unsigned 8\-bit integer.
return: decoded value

## Method: vari32
- return type: `int`

Description: Read a signed LEB128\-encoded 32\-bit integer.
return: decoded value

## Method: vari64
- return type: `long`

Description: Read a signed LEB128\-encoded 64\-bit integer.
return: decoded value

## Method: varu16
- return type: `int`

Description: Read an unsigned LEB128\-encoded 16\-bit integer.
return: decoded value

## Method: varu32
- return type: `long`

Description: Read an unsigned LEB128\-encoded 32\-bit integer.
return: decoded value

