Fields Summary |
---|
private final byte[] | bytesnon-null; array of data being dumped |
private final boolean | rawByteswhether or not to include the raw bytes (in a column on the left) |
private final PrintStream | outnon-null; where to dump to |
private final int | widthwidth of the output in columns |
private final String | filePathnon-null; the file path for the class, excluding any base directory
specification |
private final boolean | strictParsewhether to be strict about parsing |
private final int | hexColsnumber of bytes per line in hex dumps |
private int | indentthe current level of indentation |
private String | separatornon-null; the current column separator string |
private int | atthe offset of the next byte to dump |
protected Args | argscommandline parsedArgs |
Methods Summary |
---|
public void | changeIndent(int indentDelta){@inheritDoc}
indent += indentDelta;
separator = rawBytes ? "|" : "";
for (int i = 0; i < indent; i++) {
separator += " ";
}
|
static int | computeParamWidth(com.android.dx.cf.code.ConcreteMethod meth, boolean isStatic)Computes the total width, in register-units, of the parameters for
this method.
return meth.getEffectiveDescriptor().getParameterTypes().getWordCount();
|
public void | endParsingMember(com.android.dx.util.ByteArray bytes, int offset, java.lang.String name, java.lang.String descriptor, com.android.dx.cf.iface.Member member){@inheritDoc}
// This space intentionally left blank.
|
protected final int | getAt()Gets the current dump cursor (that is, the offset of the expected
next byte to dump).
return at;
|
protected final byte[] | getBytes()Gets the array of byte s to process.
return bytes;
|
protected final java.lang.String | getFilePath()Gets the filesystem/jar path of the file being dumped.
return filePath;
|
protected final boolean | getRawBytes()Gets whether this dump is to include raw bytes.
return rawBytes;
|
protected final boolean | getStrictParse()Gets whether to be strict about parsing.
return strictParse;
|
protected final int | getWidth1()Gets the width of the first column of output. This is 0
unless raw bytes are being included in the output.
if (rawBytes) {
return 5 + (hexCols * 2) + (hexCols / 2);
}
return 0;
|
protected final int | getWidth2()Gets the width of the second column of output.
int w1 = rawBytes ? (getWidth1() + 1) : 0;
return width - w1 - (indent * 2);
|
protected final java.lang.String | hexDump(int offset, int len)Constructs a hex data dump of the given portion of {@link #bytes}.
return Hex.dump(bytes, offset, len, offset, hexCols, 4);
|
public void | parsed(com.android.dx.util.ByteArray bytes, int offset, int len, java.lang.String human){@inheritDoc}
offset = bytes.underlyingOffset(offset, getBytes());
boolean rawBytes = getRawBytes();
if (offset < at) {
println("<dump skipped backwards to " + Hex.u4(offset) + ">");
at = offset;
} else if (offset > at) {
String hex = rawBytes ? hexDump(at, offset - at) : "";
print(twoColumns(hex, "<skipped to " + Hex.u4(offset) + ">"));
at = offset;
}
String hex = rawBytes ? hexDump(offset, len) : "";
print(twoColumns(hex, human));
at += len;
|
protected final void | print(java.lang.String s)Prints the given string to this instance's output stream.
out.print(s);
|
protected final void | println(java.lang.String s)Prints the given string to this instance's output stream, followed
by a newline.
out.println(s);
|
protected final void | setAt(com.android.dx.util.ByteArray arr, int offset)Sets the dump cursor to the indicated offset in the given array.
at = arr.underlyingOffset(offset, bytes);
|
public void | startParsingMember(com.android.dx.util.ByteArray bytes, int offset, java.lang.String name, java.lang.String descriptor){@inheritDoc}
// This space intentionally left blank.
|
protected final java.lang.String | twoColumns(java.lang.String s1, java.lang.String s2)Combines a pair of strings as two columns, or if this is one-column
output, format the otherwise-second column.
int w1 = getWidth1();
int w2 = getWidth2();
try {
if (w1 == 0) {
int len2 = s2.length();
StringWriter sw = new StringWriter(len2 * 2);
IndentingWriter iw = new IndentingWriter(sw, w2, separator);
iw.write(s2);
if ((len2 == 0) || (s2.charAt(len2 - 1) != '\n")) {
iw.write('\n");
}
iw.flush();
return sw.toString();
} else {
return TwoColumnOutput.toString(s1, w1, separator, s2, w2);
}
} catch (IOException ex) {
throw new RuntimeException(ex);
}
|