Interface SequentialReader
- All Known Implementing Classes:
ClassfileReader
public interface SequentialReader
Interface for sequentially reading values in byte order.
-
Method Summary
Modifier and TypeMethodDescriptionbyte
readByte()
Read a byte at the current cursor position.int
readInt()
Read a int at the current cursor position.long
readLong()
Read a long at the current cursor position.short
Read a short at the current cursor position.readString
(int numBytes) Reads the "modified UTF8" format defined in the Java classfile spec.readString
(int numBytes, boolean replaceSlashWithDot, boolean stripLSemicolon) Reads the "modified UTF8" format defined in the Java classfile spec, optionally replacing '/' with '.', and optionally removing the prefix "L" and the suffix ";".int
Read an unsigned byte at the current cursor position.long
Read a unsigned int at the current cursor position.int
Read a unsigned short at the current cursor position.void
skip
(int bytesToSkip) Skip the given number of bytes.
-
Method Details
-
readByte
Read a byte at the current cursor position.- Returns:
- The byte at the current cursor position.
- Throws:
IOException
- If there was an exception while reading.
-
readUnsignedByte
Read an unsigned byte at the current cursor position.- Returns:
- The unsigned byte at the current cursor position.
- Throws:
IOException
- If there was an exception while reading.
-
readShort
Read a short at the current cursor position.- Returns:
- The short at the current cursor position.
- Throws:
IOException
- If there was an exception while reading.
-
readUnsignedShort
Read a unsigned short at the current cursor position.- Returns:
- The unsigned shortat the current cursor position.
- Throws:
IOException
- If there was an exception while reading.
-
readInt
Read a int at the current cursor position.- Returns:
- The int at the current cursor position.
- Throws:
IOException
- If there was an exception while reading.
-
readUnsignedInt
Read a unsigned int at the current cursor position.- Returns:
- The int at the current cursor position, as a long.
- Throws:
IOException
- If there was an exception while reading.
-
readLong
Read a long at the current cursor position.- Returns:
- The long at the current cursor position.
- Throws:
IOException
- If there was an exception while reading.
-
skip
Skip the given number of bytes.- Parameters:
bytesToSkip
- The number of bytes to skip.- Throws:
IOException
- If there was an exception while reading.
-
readString
String readString(int numBytes, boolean replaceSlashWithDot, 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:
numBytes
- The number of bytes of the UTF8 encoding of the string.replaceSlashWithDot
- If true, replace '/' with '.'.stripLSemicolon
- If true, string final ';' character.- Returns:
- The string.
- Throws:
IOException
- If an I/O exception occurs.
-
readString
Reads the "modified UTF8" format defined in the Java classfile spec.- Parameters:
numBytes
- The number of bytes of the UTF8 encoding of the string.- Returns:
- The string.
- Throws:
IOException
- If an I/O exception occurs.
-