Java Code Examples for com.android.dx.cf.direct.DirectClassFile#setObserver()

The following examples show how to use com.android.dx.cf.direct.DirectClassFile#setObserver() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClassDumper.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * Does the dumping.
 */
public void dump() {
    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 readBytes = getReadBytes();
    if (readBytes != bytes.length) {
        parsed(ba, readBytes, bytes.length - readBytes, "<extra data at end of file>");
    }
}
 
Example 2
Source File: BlockDumper.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * Does the dumping.
 */
public void dump() {
    byte[] bytes = getBytes();
    ByteArray ba = new ByteArray(bytes);

    /*
     * First, parse the file completely, so we can safely refer to
     * attributes, etc.
     */
    classFile = new DirectClassFile(ba, getFilePath(), getStrictParse());
    classFile.setAttributeFactory(StdAttributeFactory.THE_ONE);
    classFile.getMagic(); // Force parsing to happen.

    // Next, reparse it and observe the process.
    DirectClassFile liveCf =
        new DirectClassFile(ba, getFilePath(), getStrictParse());
    liveCf.setAttributeFactory(StdAttributeFactory.THE_ONE);
    liveCf.setObserver(this);
    liveCf.getMagic(); // Force parsing to happen.
}
 
Example 3
Source File: DotDumper.java    From Box with Apache License 2.0 6 votes vote down vote up
private void run() {
    ByteArray ba = new ByteArray(bytes);

    /*
     * First, parse the file completely, so we can safely refer to
     * attributes, etc.
     */
    classFile = new DirectClassFile(ba, filePath, strictParse);
    classFile.setAttributeFactory(StdAttributeFactory.THE_ONE);
    classFile.getMagic(); // Force parsing to happen.

    // Next, reparse it and observe the process.
    DirectClassFile liveCf =
        new DirectClassFile(ba, filePath, strictParse);
    liveCf.setAttributeFactory(StdAttributeFactory.THE_ONE);
    liveCf.setObserver(this);
    liveCf.getMagic(); // Force parsing to happen.
}
 
Example 4
Source File: ClassDumper.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * Does the dumping.
 */
public void dump() {
    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 readBytes = getReadBytes();
    if (readBytes != bytes.length) {
        parsed(ba, readBytes, bytes.length - readBytes, "<extra data at end of file>");
    }
}
 
Example 5
Source File: BlockDumper.java    From Box with Apache License 2.0 6 votes vote down vote up
/**
 * Does the dumping.
 */
public void dump() {
    byte[] bytes = getBytes();
    ByteArray ba = new ByteArray(bytes);

    /*
     * First, parse the file completely, so we can safely refer to
     * attributes, etc.
     */
    classFile = new DirectClassFile(ba, getFilePath(), getStrictParse());
    classFile.setAttributeFactory(StdAttributeFactory.THE_ONE);
    classFile.getMagic(); // Force parsing to happen.

    // Next, reparse it and observe the process.
    DirectClassFile liveCf =
        new DirectClassFile(ba, getFilePath(), getStrictParse());
    liveCf.setAttributeFactory(StdAttributeFactory.THE_ONE);
    liveCf.setObserver(this);
    liveCf.getMagic(); // Force parsing to happen.
}
 
Example 6
Source File: DotDumper.java    From Box with Apache License 2.0 6 votes vote down vote up
private void run() {
    ByteArray ba = new ByteArray(bytes);

    /*
     * First, parse the file completely, so we can safely refer to
     * attributes, etc.
     */
    classFile = new DirectClassFile(ba, filePath, strictParse);
    classFile.setAttributeFactory(StdAttributeFactory.THE_ONE);
    classFile.getMagic(); // Force parsing to happen.

    // Next, reparse it and observe the process.
    DirectClassFile liveCf =
        new DirectClassFile(ba, filePath, strictParse);
    liveCf.setAttributeFactory(StdAttributeFactory.THE_ONE);
    liveCf.setObserver(this);
    liveCf.getMagic(); // Force parsing to happen.
}
 
Example 7
Source File: ClassDumper.java    From buck with Apache License 2.0 6 votes vote down vote up
/**
 * Does the dumping.
 */
public void dump() {
    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>");
    }
}
 
Example 8
Source File: BlockDumper.java    From buck with Apache License 2.0 6 votes vote down vote up
/**
 * Does the dumping.
 */
public void dump() {
    byte[] bytes = getBytes();
    ByteArray ba = new ByteArray(bytes);

    /*
     * First, parse the file completely, so we can safely refer to
     * attributes, etc.
     */
    classFile = new DirectClassFile(ba, getFilePath(), getStrictParse());
    classFile.setAttributeFactory(StdAttributeFactory.THE_ONE);
    classFile.getMagic(); // Force parsing to happen.

    // Next, reparse it and observe the process.
    DirectClassFile liveCf =
        new DirectClassFile(ba, getFilePath(), getStrictParse());
    liveCf.setAttributeFactory(StdAttributeFactory.THE_ONE);
    liveCf.setObserver(this);
    liveCf.getMagic(); // Force parsing to happen.
}
 
Example 9
Source File: DotDumper.java    From buck with Apache License 2.0 6 votes vote down vote up
private void run() {
    ByteArray ba = new ByteArray(bytes);

    /*
     * First, parse the file completely, so we can safely refer to
     * attributes, etc.
     */
    classFile = new DirectClassFile(ba, filePath, strictParse);
    classFile.setAttributeFactory(StdAttributeFactory.THE_ONE);
    classFile.getMagic(); // Force parsing to happen.

    // Next, reparse it and observe the process.
    DirectClassFile liveCf =
        new DirectClassFile(ba, filePath, strictParse);
    liveCf.setAttributeFactory(StdAttributeFactory.THE_ONE);
    liveCf.setObserver(this);
    liveCf.getMagic(); // Force parsing to happen.
}