Package de.inetsoftware.classparser
Class CodeInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
java.io.DataInputStream
de.inetsoftware.classparser.CodeInputStream
- All Implemented Interfaces:
Closeable
,DataInput
,AutoCloseable
Extends the DataInputStream with a code position.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsFields inherited from class java.io.FilterInputStream
in
-
Constructor Summary
ConstructorsModifierConstructorDescription(package private)
CodeInputStream
(byte[] buf, int offset, int length, Code code) Create a new instance of CodeInputStream.private
-
Method Summary
Modifier and TypeMethodDescriptionint
Get the code index of the current read position.int
Line number in the source code or -1 if not availableint
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, skipNBytes, transferTo
-
Field Details
-
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 codeoffset
- the offset in the arraylength
- the lengthcode
- the calling code to get the line numbers
-
CodeInputStream
-
-
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
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
-