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