Class CodeInputStream

All Implemented Interfaces:
Closeable, DataInput, AutoCloseable

public class CodeInputStream extends DataInputStream
Extends the DataInputStream with a code position.
  • Field Details

    • code

      private Code code
  • Constructor Details

    • CodeInputStream

      CodeInputStream(byte[] buf, int offset, int length, Code code)
      Create a new instance of CodeInputStream.
      Parameters:
      buf - the buffer with the Java byte code
      offset - the offset in the array
      length - the length
      code - the calling code to get the line numbers
    • CodeInputStream

      private CodeInputStream(CodeInputStream.ByteCodeArrayInputStream in)
  • Method Details

    • getCodePosition

      public int getCodePosition()
      Get the code index of the current read position.
      Returns:
      the position
    • getLineNumber

      public int getLineNumber()
      Line number in the source code or -1 if not available
      Returns:
      the line number
    • readUnsignedIndex

      public int readUnsignedIndex(boolean wide) throws IOException
      Read an unsigned index. For example for a variable.
      Parameters:
      wide - true, 2 byte index
      Returns:
      the unsigned value
      Throws:
      IOException - if any I/O errors occur