Class CodeInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.DataInput, java.lang.AutoCloseable

    public class CodeInputStream
    extends java.io.DataInputStream
    Extends the DataInputStream with a code position.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private Code code  
      • Fields inherited from class java.io.FilterInputStream

        in
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getCodePosition()
      Get the code index of the current read position.
      int getLineNumber()
      Line number in the source code or -1 if not available
      int readUnsignedIndex​(boolean wide)
      Read an unsigned index.
      • Methods inherited from class java.io.DataInputStream

        read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTF, skipBytes
      • Methods inherited from class java.io.FilterInputStream

        available, close, mark, markSupported, read, reset, skip
      • Methods inherited from class java.io.InputStream

        nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • code

        private Code code
    • Constructor Detail

      • 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
    • Method Detail

      • 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 java.io.IOException
        Read an unsigned index. For example for a variable.
        Parameters:
        wide - true, 2 byte index
        Returns:
        the unsigned value
        Throws:
        java.io.IOException - if any I/O errors occur