Top Description Methods
nonapi.io.github.classgraph.fileslice.reader

public Interface RandomAccessReader

Known Direct Implementers
nonapi.io.github.classgraph.fileslice.reader.ClassfileReader, nonapi.io.github.classgraph.fileslice.reader.RandomAccessArrayReader, nonapi.io.github.classgraph.fileslice.reader.RandomAccessByteBufferReader, nonapi.io.github.classgraph.fileslice.reader.RandomAccessFileChannelReader
Imports
java.io.IOException, java.nio.ByteBuffer

Interface for random access to values in byte order.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

The number of bytes actually read, or -1 if no more bytes could be read.
read
(long
The offset to start reading from.
srcOffset
,
ByteBuffer
The ByteBuffer to write into.
dstBuf
,
int
The offset within the destination buffer to start writing at.
dstBufStart
,
int
The number of bytes to read.
numBytes
)

Read bytes into a ByteBuffer.

public int

Returns:

The number of bytes actually read, or -1 if no more bytes could be read.
read
(long
The offset to start reading from.
srcOffset
,
byte[]
The byte array to write into.
dstArr
,
int
The offset within the destination array to start writing at.
dstArrStart
,
int
The number of bytes to read.
numBytes
)

Read bytes into a byte array.

public byte

Returns:

The byte at the offset.
readByte
(final long
The buffer offset to read from.
offset
)

Read a byte at a specific offset (without changing the current cursor offset).

public int

Returns:

The int at the offset.
readInt
(final long
The buffer offset to read from.
offset
)

Read a int at a specific offset (without changing the current cursor offset).

public long

Returns:

The long at the offset.
readLong
(final long
The buffer offset to read from.
offset
)

Read a long at a specific offset (without changing the current cursor offset).

public short

Returns:

The short at the offset.
readShort
(final long
The buffer offset to read from.
offset
)

Read a short at a specific offset (without changing the current cursor offset).

public String

Returns:

The string.
readString
(final long
The start offset of the string.
offset
,
final int
The number of bytes of the UTF8 encoding of the string.
numBytes
,
final boolean
If true, replace '/' with '.'.
replaceSlashWithDot
,
final boolean
If true, string final ';' character.
stripLSemicolon
)

Reads the "modified UTF8" format defined in the Java classfile spec, optionally replacing '/' with '.', and optionally removing the prefix "L" and the suffix ";".

public String

Returns:

The string.
readString
(final long
The start offset of the string.
offset
,
final int
The number of bytes of the UTF8 encoding of the string.
numBytes
)

Reads the "modified UTF8" format defined in the Java classfile spec.

public int

Returns:

The unsigned byte at the offset.
readUnsignedByte
(final long
The buffer offset to read from.
offset
)

Read an unsigned byte at a specific offset (without changing the current cursor offset).

public long

Returns:

The int at the offset, as a long.
readUnsignedInt
(final long
The buffer offset to read from.
offset
)

Read a unsigned int at a specific offset (without changing the current cursor offset).

public int

Returns:

The unsigned short at the offset.
readUnsignedShort
(final long
The buffer offset to read from.
offset
)

Read a unsigned short at a specific offset (without changing the current cursor offset).

Method Detail

readback to summary
public int read(long srcOffset, ByteBuffer dstBuf, int dstBufStart, int numBytes) throws IOException

Read bytes into a ByteBuffer.

Parameters
srcOffset:long

The offset to start reading from.

dstBuf:ByteBuffer

The ByteBuffer to write into.

dstBufStart:int

The offset within the destination buffer to start writing at.

numBytes:int

The number of bytes to read.

Returns:int

The number of bytes actually read, or -1 if no more bytes could be read.

Exceptions
IOException:
If there was an exception while reading.
readback to summary
public int read(long srcOffset, byte[] dstArr, int dstArrStart, int numBytes) throws IOException

Read bytes into a byte array.

Parameters
srcOffset:long

The offset to start reading from.

dstArr:byte[]

The byte array to write into.

dstArrStart:int

The offset within the destination array to start writing at.

numBytes:int

The number of bytes to read.

Returns:int

The number of bytes actually read, or -1 if no more bytes could be read.

Exceptions
IOException:
If there was an exception while reading.
readByteback to summary
public byte readByte(final long offset) throws IOException

Read a byte at a specific offset (without changing the current cursor offset).

Parameters
offset:long

The buffer offset to read from.

Returns:byte

The byte at the offset.

Exceptions
IOException:
If there was an exception while reading.
readIntback to summary
public int readInt(final long offset) throws IOException

Read a int at a specific offset (without changing the current cursor offset).

Parameters
offset:long

The buffer offset to read from.

Returns:int

The int at the offset.

Exceptions
IOException:
If there was an exception while reading.
readLongback to summary
public long readLong(final long offset) throws IOException

Read a long at a specific offset (without changing the current cursor offset).

Parameters
offset:long

The buffer offset to read from.

Returns:long

The long at the offset.

Exceptions
IOException:
If there was an exception while reading.
readShortback to summary
public short readShort(final long offset) throws IOException

Read a short at a specific offset (without changing the current cursor offset).

Parameters
offset:long

The buffer offset to read from.

Returns:short

The short at the offset.

Exceptions
IOException:
If there was an exception while reading.
readStringback to summary
public String readString(final long offset, final int numBytes, final boolean replaceSlashWithDot, final boolean stripLSemicolon) throws IOException

Reads the "modified UTF8" format defined in the Java classfile spec, optionally replacing '/' with '.', and optionally removing the prefix "L" and the suffix ";".

Parameters
offset:long

The start offset of the string.

numBytes:int

The number of bytes of the UTF8 encoding of the string.

replaceSlashWithDot:boolean

If true, replace '/' with '.'.

stripLSemicolon:boolean

If true, string final ';' character.

Returns:String

The string.

Exceptions
IOException:
If an I/O exception occurs.
readStringback to summary
public String readString(final long offset, final int numBytes) throws IOException

Reads the "modified UTF8" format defined in the Java classfile spec.

Parameters
offset:long

The start offset of the string.

numBytes:int

The number of bytes of the UTF8 encoding of the string.

Returns:String

The string.

Exceptions
IOException:
If an I/O exception occurs.
readUnsignedByteback to summary
public int readUnsignedByte(final long offset) throws IOException

Read an unsigned byte at a specific offset (without changing the current cursor offset).

Parameters
offset:long

The buffer offset to read from.

Returns:int

The unsigned byte at the offset.

Exceptions
IOException:
If there was an exception while reading.
readUnsignedIntback to summary
public long readUnsignedInt(final long offset) throws IOException

Read a unsigned int at a specific offset (without changing the current cursor offset).

Parameters
offset:long

The buffer offset to read from.

Returns:long

The int at the offset, as a long.

Exceptions
IOException:
If there was an exception while reading.
readUnsignedShortback to summary
public int readUnsignedShort(final long offset) throws IOException

Read a unsigned short at a specific offset (without changing the current cursor offset).

Parameters
offset:long

The buffer offset to read from.

Returns:int

The unsigned short at the offset.

Exceptions
IOException:
If there was an exception while reading.