# Class: com.pnfsoftware.jeb.util.io.ByteBufferUtil

Utility methods for [ByteBuffer](ByteBuffer)s.

## Static Method: align
- parameter: `b`, type: `java.nio.ByteBuffer`
- parameter: `align`, type: `int`
- return type: `int`

Description: Align the buffer using the provided byte alignment. The position will be increased from anything from 0 to ALIGN\-1 bytes so that the new position is congruent to 0 \(modulo N\).
parameter: b: buffer to align
parameter: align: must be \>= 1
return: the buffer's new position

## Static Method: equalsByteArray
- parameter: `b`, type: `java.nio.ByteBuffer`
- parameter: `bufferOffset`, type: `int`
- parameter: `a`, type: `byte[]`
- parameter: `arrayOffset`, type: `int`
- parameter: `size`, type: `int`
- return type: `boolean`

Description: Compare bytes of a buffer against the bytes of an array.
parameter: b: source buffer
parameter: bufferOffset: offset in buffer
parameter: a: source array
parameter: arrayOffset: offset in array
parameter: size: number of bytes to be compared
return: true on equality

## Static Method: getBytes
- parameter: `b`, type: `java.nio.ByteBuffer`
- parameter: `offset`, type: `int`
- parameter: `size`, type: `int`
- return type: `byte[]`

Description: Extract a sequence of bytes from a buffer into a newly\-created byte array.
parameter: b: source buffer
parameter: offset: offset in `b`
parameter: size: number of bytes to read
return: newly allocated byte array

## Static Method: getBytes
- parameter: `b`, type: `java.nio.ByteBuffer`
- return type: `byte[]`

Description: Read the remaining bytes of a buffer.
parameter: b: source buffer
return: newly allocated byte array

## Static Method: getUnsignedInt
- parameter: `b`, type: `java.nio.ByteBuffer`
- return type: `long`

Description: Unpack a 4\-byte int and zero\-extend it to a long.
parameter: b: source buffer
return: unsigned integer value

## Static Method: getUnsignedInt
- parameter: `b`, type: `java.nio.ByteBuffer`
- parameter: `index`, type: `int`
- return type: `long`

Description: Unpack a 4\-byte int and zero\-extend it to a long.
parameter: b: source buffer
parameter: index: absolute buffer index
return: unsigned integer value

## Static Method: skipAttempt
- parameter: `b`, type: `java.nio.ByteBuffer`
- parameter: `n`, type: `int`
- return type: `int`

Description: Attempt to skip bytes, including "backward skipping".
parameter: b: buffer byte buffer
parameter: n: number of bytes to skip \(move forward\); can be negative to partially rewind the            pointer
return: the number of bytes skipped.

## Static Method: skipExact
- parameter: `b`, type: `java.nio.ByteBuffer`
- parameter: `n`, type: `int`

Description: Skip bytes, including "backward skipping". An exception is raised if the exact amount of bytes could not be skipped.
parameter: b: buffer byte buffer
parameter: n: number of bytes to skip \(move forward\); can be negative to partially rewind the            pointer

## Static Method: skipToEnd
- parameter: `b`, type: `java.nio.ByteBuffer`

Description: Go to the end of the buffer.
parameter: b: buffer

## Static Method: wrapBE
- parameter: `array`, type: `byte[]`
- return type: `java.nio.ByteBuffer`

Description: Wrap the provided bytes in a big\-endian buffer.
parameter: array: backing byte array
return: big\-endian byte buffer

## Static Method: wrapBE
- parameter: `array`, type: `byte[]`
- parameter: `offset`, type: `int`
- parameter: `length`, type: `int`
- return type: `java.nio.ByteBuffer`

Description: Wrap the provided bytes in a big\-endian buffer.
parameter: array: backing byte array
parameter: offset: first byte to expose
parameter: length: number of bytes to expose
return: big\-endian byte buffer

## Static Method: wrapLE
- parameter: `array`, type: `byte[]`
- return type: `java.nio.ByteBuffer`

Description: Wrap the provided bytes in a little\-endian buffer.
parameter: array: backing byte array
return: little\-endian byte buffer

## Static Method: wrapLE
- parameter: `array`, type: `byte[]`
- parameter: `offset`, type: `int`
- parameter: `length`, type: `int`
- return type: `java.nio.ByteBuffer`

Description: Wrap the provided bytes in a little\-endian buffer.
parameter: array: backing byte array
parameter: offset: first byte to expose
parameter: length: number of bytes to expose
return: little\-endian byte buffer

