Package de.inetsoftware.classparser
Class Code
- java.lang.Object
-
- de.inetsoftware.classparser.Code
-
public class Code extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private Attributes
attributes
private byte[]
codeData
private ConstantPool
constantPool
private TryCatchFinally[]
exceptionTable
private LineNumberTable
lineNumberTable
private LocalVariableTable
localVariableTable
private int
maxLocals
private int
maxStack
private static TryCatchFinally[]
NO_TRY_CATCHES
-
Constructor Summary
Constructors Constructor Description Code(java.io.DataInputStream input, ConstantPool constantPool)
The code of a method attribute.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CodeInputStream
getByteCode()
Get the stream of Java Byte code instruction of this method.int
getCodeSize()
Get the last position of the code.ConstantPool
getConstantPool()
Get the constant pool of this code.TryCatchFinally[]
getExceptionTable()
Get exception table of this code block.int
getFirstLineNr()
LineNumberTable
getLineNumberTable()
Get the line number table.LocalVariableTable
getLocalVariableTable()
Get the local variable table of this method.private static TryCatchFinally[]
readExceptionTable(java.io.DataInputStream input, ConstantPool constantPool)
Read the exception table and correct some problems.
-
-
-
Field Detail
-
NO_TRY_CATCHES
private static final TryCatchFinally[] NO_TRY_CATCHES
-
constantPool
private final ConstantPool constantPool
-
maxStack
private final int maxStack
-
maxLocals
private final int maxLocals
-
codeData
private final byte[] codeData
-
exceptionTable
private final TryCatchFinally[] exceptionTable
-
attributes
private final Attributes attributes
-
lineNumberTable
private LineNumberTable lineNumberTable
-
localVariableTable
private LocalVariableTable localVariableTable
-
-
Constructor Detail
-
Code
Code(java.io.DataInputStream input, @Nonnull ConstantPool constantPool) throws java.io.IOException
The code of a method attribute. http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.3 http://docs.oracle.com/javase/specs/jvms/se5.0/html/ClassFile.doc.html#1546- Parameters:
input
- the stream of the code attributeconstantPool
- the ConstantPool of the class- Throws:
java.io.IOException
- if an I/O error occurs
-
-
Method Detail
-
readExceptionTable
private static TryCatchFinally[] readExceptionTable(java.io.DataInputStream input, @Nonnull ConstantPool constantPool) throws java.io.IOException
Read the exception table and correct some problems.- Parameters:
input
- the stream of the code attributeconstantPool
- the ConstantPool of the class- Returns:
- the exception table
- Throws:
java.io.IOException
- if an I/O error occurs
-
getConstantPool
@Nonnull public ConstantPool getConstantPool()
Get the constant pool of this code.- Returns:
- the ConstantPool of the class
-
getExceptionTable
@Nonnull public TryCatchFinally[] getExceptionTable()
Get exception table of this code block.- Returns:
- the table, can be empty
-
getLineNumberTable
@Nullable public LineNumberTable getLineNumberTable() throws java.io.IOException
Get the line number table. is null if the code was optimized.- Returns:
- the table or null
- Throws:
java.io.IOException
- if any I/O error occur
-
getLocalVariableTable
@Nullable public LocalVariableTable getLocalVariableTable() throws java.io.IOException
Get the local variable table of this method.- Returns:
- the variables
- Throws:
java.io.IOException
- if any I/O error occur
-
getFirstLineNr
public int getFirstLineNr() throws java.io.IOException
- Throws:
java.io.IOException
-
getByteCode
public CodeInputStream getByteCode()
Get the stream of Java Byte code instruction of this method.- Returns:
- the stream
-
getCodeSize
public int getCodeSize()
Get the last position of the code.- Returns:
- the size.
-
-