|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.android.dx.util.ByteArrayAnnotatedOutput
public final class ByteArrayAnnotatedOutput
Implementation of AnnotatedOutput which stores the written data
into a byte[].
Note: As per the Output interface, multi-byte
writes all use little-endian order.
| Constructor Summary | |
|---|---|
ByteArrayAnnotatedOutput()
Constructs a "stretchy" instance. |
|
ByteArrayAnnotatedOutput(byte[] data)
Constructs an instance with a fixed maximum size. |
|
ByteArrayAnnotatedOutput(int size)
Constructs a "stretchy" instance with initial size size. |
|
| Method Summary | |
|---|---|
void |
alignTo(int alignment)
Adds extra bytes if necessary (with value 0) to
force alignment of the output cursor as given. |
void |
annotate(int amt,
String msg)
Add an annotation for a specified amount of subsequent output. |
void |
annotate(String msg)
Add an annotation for the subsequent output. |
boolean |
annotates()
Get whether this instance will actually keep annotations. |
void |
assertCursor(int expectedCursor)
Asserts that the cursor is the given value. |
void |
enableAnnotations(int annotationWidth,
boolean verbose)
Indicates that this instance should keep annotations. |
void |
endAnnotation()
End the most recent annotation. |
void |
finishAnnotating()
Finishes up annotation processing. |
int |
getAnnotationWidth()
Get the maximum width of the annotated output. |
byte[] |
getArray()
Gets the underlying byte[] of this instance, which
may be larger than the number of bytes written |
int |
getCursor()
Gets the current cursor position. |
boolean |
isVerbose()
Get whether this instance is intended to keep verbose annotations. |
byte[] |
toByteArray()
Constructs and returns a new byte[] that contains
the written contents exactly (that is, with no extra unwritten
bytes at the end). |
void |
write(byte[] bytes)
Writes a byte[] to this instance. |
void |
write(byte[] bytes,
int offset,
int length)
Writes a portion of a byte[] to this instance. |
void |
write(ByteArray bytes)
Writes a ByteArray to this instance. |
void |
writeAnnotationsTo(Writer out)
Writes the annotated content of this instance to the given writer. |
void |
writeByte(int value)
Writes a byte to this instance. |
void |
writeInt(int value)
Writes an int to this instance. |
void |
writeLong(long value)
Writes a long to this instance. |
void |
writeShort(int value)
Writes a short to this instance. |
int |
writeSleb128(int value)
Writes a DWARFv3-style unsigned LEB128 integer. |
int |
writeUleb128(int value)
Writes a DWARFv3-style unsigned LEB128 integer. |
void |
writeZeroes(int count)
Writes the given number of 0 bytes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ByteArrayAnnotatedOutput(byte[] data)
data - non-null; data array to use for outputpublic ByteArrayAnnotatedOutput()
public ByteArrayAnnotatedOutput(int size)
size. The
underlying array may be reallocated. The constructed instance does not
keep annotations by default.
| Method Detail |
|---|
public byte[] getArray()
byte[] of this instance, which
may be larger than the number of bytes written
non-null; the byte[]toByteArray()public byte[] toByteArray()
byte[] that contains
the written contents exactly (that is, with no extra unwritten
bytes at the end).
non-null; an appropriately-constructed arraygetArray()public int getCursor()
getCursor in interface Output>= 0; the cursor positionpublic void assertCursor(int expectedCursor)
assertCursor in interface OutputexpectedCursor - the expected cursor valuepublic void writeByte(int value)
byte to this instance.
writeByte in interface com.android.dex.util.ByteOutputwriteByte in interface Outputvalue - the value to write; all but the low 8 bits are ignoredpublic void writeShort(int value)
short to this instance.
writeShort in interface Outputvalue - the value to write; all but the low 16 bits are ignoredpublic void writeInt(int value)
int to this instance.
writeInt in interface Outputvalue - the value to writepublic void writeLong(long value)
long to this instance.
writeLong in interface Outputvalue - the value to writepublic int writeUleb128(int value)
writeUleb128 in interface Outputvalue - value to write, treated as an unsigned value
1..5; the number of bytes actually writtenpublic int writeSleb128(int value)
writeSleb128 in interface Outputvalue - value to write
1..5; the number of bytes actually writtenpublic void write(ByteArray bytes)
ByteArray to this instance.
write in interface Outputbytes - non-null; the array to write
public void write(byte[] bytes,
int offset,
int length)
byte[] to this instance.
write in interface Outputbytes - non-null; the array to writeoffset - >= 0; offset into bytes for the first
byte to writelength - >= 0; number of bytes to writepublic void write(byte[] bytes)
byte[] to this instance. This is just
a convenient shorthand for write(bytes, 0, bytes.length).
write in interface Outputbytes - non-null; the array to writepublic void writeZeroes(int count)
0 bytes.
writeZeroes in interface Outputcount - >= 0; the number of zeroes to writepublic void alignTo(int alignment)
0) to
force alignment of the output cursor as given.
alignTo in interface Outputalignment - > 0; the alignment; must be a power of twopublic boolean annotates()
annotates in interface AnnotatedOutputtrue iff annotations are being keptpublic boolean isVerbose()
isVerbose in interface AnnotatedOutputtrue iff annotations are to be verbosepublic void annotate(String msg)
annotate in interface AnnotatedOutputmsg - non-null; the annotation message
public void annotate(int amt,
String msg)
annotate in interface AnnotatedOutputamt - >= 0; the amount of output for this annotation to
covermsg - non-null; the annotation messagepublic void endAnnotation()
AnnotatedOutput.annotate(java.lang.String).
endAnnotation in interface AnnotatedOutputpublic int getAnnotationWidth()
getAnnotationWidth in interface AnnotatedOutput>= 1; the maximum width
public void enableAnnotations(int annotationWidth,
boolean verbose)
annotationWidth - >= 40; the desired maximum annotation widthverbose - whether or not to indicate verbose annotationspublic void finishAnnotating()
public void writeAnnotationsTo(Writer out)
throws IOException
out - non-null; where to write to
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||