Package gnu.bytecode
Class ClassFileInput
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- java.io.DataInputStream
-
- gnu.bytecode.ClassFileInput
-
- All Implemented Interfaces:
java.io.Closeable,java.io.DataInput,java.lang.AutoCloseable
- Direct Known Subclasses:
dump
public class ClassFileInput extends java.io.DataInputStreamClass to read a ClassType from a DataInputStream (.class file).
-
-
Constructor Summary
Constructors Constructor Description ClassFileInput(ClassType ctype, java.io.InputStream str)ClassFileInput(java.io.InputStream str)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AttributereadAttribute(java.lang.String name, int length, AttrContainer container)intreadAttributes(AttrContainer container)voidreadClassInfo()static ClassTypereadClassType(java.io.InputStream str)Read a class (in .class format) from an InputStream.ConstantPoolreadConstants()voidreadFields()voidreadFormatVersion()booleanreadHeader()voidreadMethods()voidskipAttribute(int length)-
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
-
-
-
-
Constructor Detail
-
ClassFileInput
public ClassFileInput(java.io.InputStream str) throws java.io.IOException- Throws:
java.io.IOException
-
ClassFileInput
public ClassFileInput(ClassType ctype, java.io.InputStream str) throws java.io.IOException, java.lang.ClassFormatError
- Throws:
java.io.IOExceptionjava.lang.ClassFormatError
-
-
Method Detail
-
readClassType
public static ClassType readClassType(java.io.InputStream str) throws java.io.IOException, java.lang.ClassFormatError
Read a class (in .class format) from an InputStream.- Returns:
- A new ClassType object representing the class that was read.
- Throws:
java.io.IOExceptionjava.lang.ClassFormatError
-
readHeader
public boolean readHeader() throws java.io.IOException- Throws:
java.io.IOException
-
readFormatVersion
public void readFormatVersion() throws java.io.IOException- Throws:
java.io.IOException
-
readConstants
public ConstantPool readConstants() throws java.io.IOException
- Throws:
java.io.IOException
-
readClassInfo
public void readClassInfo() throws java.io.IOException- Throws:
java.io.IOException
-
readAttributes
public int readAttributes(AttrContainer container) throws java.io.IOException
- Throws:
java.io.IOException
-
skipAttribute
public final void skipAttribute(int length) throws java.io.IOException- Throws:
java.io.IOException
-
readAttribute
public Attribute readAttribute(java.lang.String name, int length, AttrContainer container) throws java.io.IOException
- Throws:
java.io.IOException
-
readFields
public void readFields() throws java.io.IOException- Throws:
java.io.IOException
-
readMethods
public void readMethods() throws java.io.IOException- Throws:
java.io.IOException
-
-