FileDocCategorySizeDatePackage
ClassDumper.javaAPI DocAndroid 5.1 API2401Thu Mar 12 22:18:30 GMT 2015com.android.dx.command.dump

ClassDumper

public final class ClassDumper extends BaseDumper
Utility to dump the contents of class files in a human-friendly form.

Fields Summary
Constructors Summary
private ClassDumper(byte[] bytes, PrintStream out, String filePath, Args args)
Constructs an instance. This class is not publicly instantiable. Use {@link #dump}.

        super(bytes, out, filePath, args);
    
Methods Summary
public static voiddump(byte[] bytes, java.io.PrintStream out, java.lang.String filePath, Args args)
Dumps the given array, interpreting it as a class file.

param
bytes {@code non-null;} bytes of the (alleged) class file
param
out {@code non-null;} where to dump to passed in as <= 0
param
filePath the file path for the class, excluding any base directory specification
param
args bag of commandline arguments

        ClassDumper cd =
            new ClassDumper(bytes, out, filePath, args);
        cd.dump();
    
public voiddump()
Does the dumping.

        byte[] bytes = getBytes();
        ByteArray ba = new ByteArray(bytes);
        DirectClassFile cf =
            new DirectClassFile(ba, getFilePath(), getStrictParse());

        cf.setAttributeFactory(StdAttributeFactory.THE_ONE);
        cf.setObserver(this);
        cf.getMagic(); // Force parsing to happen.

        int at = getAt();
        if (at != bytes.length) {
            parsed(ba, at, bytes.length - at, "<extra data at end of file>");
        }