gnu.bytecode
Class dump
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
java.io.DataInputStream
gnu.bytecode.ClassFileInput
gnu.bytecode.dump
- All Implemented Interfaces:
- java.io.Closeable, java.io.DataInput
public class dump
- extends ClassFileInput
Class to read a ClassType from a DataInputStream (.class file).
To print out the contents of a class file foo.class, you can use
the class dump
as an application:
java gnu.bytecode.dump foo.class
This will print out the constant pool, fields, methods, superclass,
and implemented interfaces of class foo
.
It is useful for printing out more detailed information
than javap
does.
Fields inherited from class java.io.FilterInputStream |
in |
Constructor Summary |
dump(java.io.InputStream str)
|
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.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
dump
public dump(java.io.InputStream str)
throws java.io.IOException,
java.lang.ClassFormatError
- Throws:
java.io.IOException
java.lang.ClassFormatError
readConstants
public ConstantPool readConstants()
throws java.io.IOException
- Overrides:
readConstants
in class ClassFileInput
- Throws:
java.io.IOException
readAttribute
public Attribute readAttribute(java.lang.String name,
int length,
AttrContainer container)
throws java.io.IOException
- Overrides:
readAttribute
in class ClassFileInput
- Throws:
java.io.IOException
printAttributes
public void printAttributes()
main
public static void main(java.lang.String[] args)
- Reads a .class file, and prints out the contents to System.out.
Very rudimentary - prints out the constant pool, and field and method
names and types, but only minimal attributes (i.e. no dis-assembly yet).
- Parameters:
args
- One argument - the name of a .class file.
usage
public static void usage()