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

Utility methods for [SeekableByteChannel](SeekableByteChannel)s.

## Static Method: get
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `position`, type: `long`
- return type: `byte`

Description: Read one byte at an absolute channel position.
parameter: channel: input channel
parameter: position: absolute channel position
return: byte value
throws: if the byte cannot be read

## Static Method: get
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- return type: `byte`

Description: Read one byte at the current channel position.
parameter: channel: input channel
return: byte value
throws: if the byte cannot be read

## Static Method: getAllFrom
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `position`, type: `long`
- return type: `byte[]`

Description: Read all remaining bytes from a channel starting at an absolute position.
parameter: channel: input channel
parameter: position: absolute start position
return: remaining bytes
throws: if the bytes cannot be read or exceed 2 GiB

## Static Method: getBEInt
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `position`, type: `long`
- return type: `int`

Description: Read a big\-endian 32\-bit integer at an absolute channel position.
parameter: channel: input channel
parameter: position: absolute channel position
return: decoded value
throws: if the value cannot be read

## Static Method: getBEInt
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- return type: `int`

Description: Read a big\-endian 32\-bit integer at the current channel position.
parameter: channel: input channel
return: decoded value
throws: if the value cannot be read

## Static Method: getBELong
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `position`, type: `long`
- return type: `long`

Description: Read a big\-endian 64\-bit integer at an absolute channel position.
parameter: channel: input channel
parameter: position: absolute channel position
return: decoded value
throws: if the value cannot be read

## Static Method: getBELong
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- return type: `long`

Description: Read a big\-endian 64\-bit integer at the current channel position.
parameter: channel: input channel
return: decoded value
throws: if the value cannot be read

## Static Method: getBEShort
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `position`, type: `long`
- return type: `short`

Description: Read a big\-endian 16\-bit integer at an absolute channel position.
parameter: channel: input channel
parameter: position: absolute channel position
return: decoded value
throws: if the value cannot be read

## Static Method: getBEShort
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- return type: `short`

Description: Read a big\-endian 16\-bit integer at the current channel position.
parameter: channel: input channel
return: decoded value
throws: if the value cannot be read

## Static Method: getBytes
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `position`, type: `long`
- parameter: `size`, type: `int`
- return type: `byte[]`

Description: Read bytes at an absolute channel position.
parameter: channel: input channel
parameter: position: absolute channel position
parameter: size: number of bytes to read
return: byte array
throws: if the requested bytes cannot be fully read

## Static Method: getBytes
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `size`, type: `int`
- return type: `byte[]`

Description: Read bytes at the current channel position.
parameter: channel: input channel
parameter: size: number of bytes to read
return: byte array
throws: if the requested bytes cannot be fully read

## Static Method: getBytesUntil
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `stopper`, type: `byte`
- parameter: `maxsize`, type: `int`
- parameter: `throwOnEOS`, type: `boolean`
- return type: `byte[]`

Description: Read from the channel until the provided byte stopped is encountered.
parameter: channel: channel
parameter: stopper: stopper byte
parameter: maxsize: maximum allowed size to read
parameter: throwOnEOS: instruct the method will throw an [IOException](IOException) if the end of input            is reached
return: the resulting array, whose last character may be the byte stopper \(unless it was not         encountered or the maximum allowed size was read\); the channel's position will be on         the subsequent byte \(or EOS\)
throws: if the bytes cannot be read

## Static Method: getInt
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `position`, type: `long`
- parameter: `endianness`, type: `java.nio.ByteOrder`
- return type: `int`

Description: Read a 32\-bit integer at an absolute channel position.
parameter: channel: input channel
parameter: position: absolute channel position
parameter: endianness: byte order
return: decoded value
throws: if the value cannot be read

## Static Method: getInt
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `endianness`, type: `java.nio.ByteOrder`
- return type: `int`

Description: Read a 32\-bit integer at the current channel position.
parameter: channel: input channel
parameter: endianness: byte order
return: decoded value
throws: if the value cannot be read

## Static Method: getLEInt
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `position`, type: `long`
- return type: `int`

Description: Read a little\-endian 32\-bit integer at an absolute channel position.
parameter: channel: input channel
parameter: position: absolute channel position
return: decoded value
throws: if the value cannot be read

## Static Method: getLEInt
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- return type: `int`

Description: Read a little\-endian 32\-bit integer at the current channel position.
parameter: channel: input channel
return: decoded value
throws: if the value cannot be read

## Static Method: getLELong
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `position`, type: `long`
- return type: `long`

Description: Read a little\-endian 64\-bit integer at an absolute channel position.
parameter: channel: input channel
parameter: position: absolute channel position
return: decoded value
throws: if the value cannot be read

## Static Method: getLELong
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- return type: `long`

Description: Read a little\-endian 64\-bit integer at the current channel position.
parameter: channel: input channel
return: decoded value
throws: if the value cannot be read

## Static Method: getLEShort
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `position`, type: `long`
- return type: `short`

Description: Read a little\-endian 16\-bit integer at an absolute channel position.
parameter: channel: input channel
parameter: position: absolute channel position
return: decoded value
throws: if the value cannot be read

## Static Method: getLEShort
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- return type: `short`

Description: Read a little\-endian 16\-bit integer at the current channel position.
parameter: channel: input channel
return: decoded value
throws: if the value cannot be read

## Static Method: getLong
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `position`, type: `long`
- parameter: `endianness`, type: `java.nio.ByteOrder`
- return type: `long`

Description: Read a 64\-bit integer at an absolute channel position.
parameter: channel: input channel
parameter: position: absolute channel position
parameter: endianness: byte order
return: decoded value
throws: if the value cannot be read

## Static Method: getLong
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `endianness`, type: `java.nio.ByteOrder`
- return type: `long`

Description: Read a 64\-bit integer at the current channel position.
parameter: channel: input channel
parameter: endianness: byte order
return: decoded value
throws: if the value cannot be read

## Static Method: getShort
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `position`, type: `long`
- parameter: `endianness`, type: `java.nio.ByteOrder`
- return type: `short`

Description: Read a 16\-bit integer at an absolute channel position.
parameter: channel: input channel
parameter: position: absolute channel position
parameter: endianness: byte order
return: decoded value
throws: if the value cannot be read

## Static Method: getShort
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `endianness`, type: `java.nio.ByteOrder`
- return type: `short`

Description: Read a 16\-bit integer at the current channel position.
parameter: channel: input channel
parameter: endianness: byte order
return: decoded value
throws: if the value cannot be read

## Static Method: read
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `position`, type: `long`
- parameter: `size`, type: `int`
- parameter: `isBigEndian`, type: `boolean`
- return type: `java.nio.ByteBuffer`

Description: Read exactly `size` bytes from a channel at an absolute position.
parameter: channel: input channel
parameter: position: absolute channel position
parameter: size: number of bytes to read
parameter: isBigEndian: true to return a big\-endian buffer, false for little\-endian
return: byte buffer containing the requested bytes
throws: if the requested bytes cannot be fully read

## Static Method: read
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `position`, type: `long`
- parameter: `size`, type: `int`
- parameter: `isBigEndian`, type: `boolean`
- parameter: `buffer`, type: `java.nio.ByteBuffer`
- return type: `java.nio.ByteBuffer`

Description: Read exactly `size` bytes from a channel at an absolute position.
parameter: channel: input channel
parameter: position: absolute channel position
parameter: size: number of bytes to read
parameter: isBigEndian: true to return a big\-endian buffer, false for little\-endian
parameter: buffer: optional reusable destination buffer
return: byte buffer containing the requested bytes
throws: if the requested bytes cannot be fully read

## Static Method: readBestEffort
- parameter: `channel`, type: `java.nio.channels.SeekableByteChannel`
- parameter: `position`, type: `long`
- parameter: `size`, type: `int`
- parameter: `isBigEndian`, type: `boolean`
- parameter: `buffer`, type: `java.nio.ByteBuffer`
- return type: `java.nio.ByteBuffer`

Description: Read up to `size` bytes from a channel at an absolute position.
parameter: channel: input channel
parameter: position: absolute channel position
parameter: size: maximum number of bytes to read
parameter: isBigEndian: true to return a big\-endian buffer, false for little\-endian
parameter: buffer: optional reusable destination buffer
return: byte buffer containing all bytes that could be read
throws: if the channel cannot be read

