use of com.taobao.android.dx.util.ByteArray in project atlas by alibaba.
the class AttributeListParser method parse.
/**
* Does the actual parsing.
*/
private void parse() {
int sz = list.size();
// Skip the count.
int at = offset + 2;
ByteArray bytes = cf.getBytes();
if (observer != null) {
observer.parsed(bytes, offset, 2, "attributes_count: " + Hex.u2(sz));
}
for (int i = 0; i < sz; i++) {
try {
if (observer != null) {
observer.parsed(bytes, at, 0, "\nattributes[" + i + "]:\n");
observer.changeIndent(1);
}
Attribute attrib = attributeFactory.parse(cf, context, at, observer);
at += attrib.byteLength();
list.set(i, attrib);
if (observer != null) {
observer.changeIndent(-1);
observer.parsed(bytes, at, 0, "end attributes[" + i + "]\n");
}
} catch (ParseException ex) {
ex.addContext("...while parsing attributes[" + i + "]");
throw ex;
} catch (RuntimeException ex) {
ParseException pe = new ParseException(ex);
pe.addContext("...while parsing attributes[" + i + "]");
throw pe;
}
}
endOffset = at;
}
use of com.taobao.android.dx.util.ByteArray in project atlas by alibaba.
the class BlockDumper method dump.
/**
* 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);
// Force parsing to happen.
classFile.getMagic();
// Next, reparse it and observe the process.
DirectClassFile liveCf = new DirectClassFile(ba, getFilePath(), getStrictParse());
liveCf.setAttributeFactory(StdAttributeFactory.THE_ONE);
liveCf.setObserver(this);
// Force parsing to happen.
liveCf.getMagic();
}
use of com.taobao.android.dx.util.ByteArray in project atlas by alibaba.
the class DotDumper method run.
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);
// Force parsing to happen.
classFile.getMagic();
// Next, reparse it and observe the process.
DirectClassFile liveCf = new DirectClassFile(ba, filePath, strictParse);
liveCf.setAttributeFactory(StdAttributeFactory.THE_ONE);
liveCf.setObserver(this);
// Force parsing to happen.
liveCf.getMagic();
}
Aggregations