Top Description Methods
org.droidparts.dexmaker.dx.util

public Interface Output

extends ByteOutput
Known Direct Subinterfaces
org.droidparts.dexmaker.dx.util.AnnotatedOutput

Interface for a sink for binary output. This is similar to java.util.DataOutput, but no IOExceptions are declared, and multibyte output is defined to be little-endian.

Method Summary

Modifier and TypeMethod and Description
public void
alignTo(int
> 0; the alignment; must be a power of two
alignment
)

Adds extra bytes if necessary (with value 0) to force alignment of the output cursor as given.

public void
assertCursor(int
the expected cursor value
expectedCursor
)

Asserts that the cursor is the given value.

public int

Returns:

>= 0; the cursor position
getCursor
()

Gets the current cursor position.

public void
write(ByteArray
non-null; the array to write
bytes
)

Writes a ByteArray to this instance.

public void
write(byte[]
non-null; the array to write
bytes
,
int
>= 0; offset into bytes for the first byte to write
offset
,
int
>= 0; number of bytes to write
length
)

Writes a portion of a byte[] to this instance.

public void
write(byte[]
non-null; the array to write
bytes
)

Writes a byte[] to this instance.

public void
writeByte(int
the value to write; all but the low 8 bits are ignored
value
)

Redeclares org.droidparts.dexmaker.dx.util.ByteOutput.writeByte.

Writes a byte to this instance.
public void
writeInt(int
the value to write
value
)

Writes an int to this instance.

public void
writeLong(long
the value to write
value
)

Writes a long to this instance.

public void
writeShort(int
the value to write; all but the low 16 bits are ignored
value
)

Writes a short to this instance.

public int

Returns:

1..5; the number of bytes actually written
writeSleb128
(int
value to write
value
)

Writes a DWARFv3-style unsigned LEB128 integer.

public int

Returns:

1..5; the number of bytes actually written
writeUleb128
(int
value to write, treated as an unsigned value
value
)

Writes a DWARFv3-style unsigned LEB128 integer.

public void
writeZeroes(int
>= 0; the number of zeroes to write
count
)

Writes the given number of 0 bytes.

Method Detail

alignToback to summary
public void alignTo(int alignment)

Adds extra bytes if necessary (with value 0) to force alignment of the output cursor as given.

Parameters
alignment:int

> 0; the alignment; must be a power of two

assertCursorback to summary
public void assertCursor(int expectedCursor)

Asserts that the cursor is the given value.

Parameters
expectedCursor:int

the expected cursor value

Exceptions
RuntimeException:
thrown if getCursor() != expectedCursor
getCursorback to summary
public int getCursor()

Gets the current cursor position. This is the same as the number of bytes written to this instance.

Returns:int

>= 0; the cursor position

writeback to summary
public void write(ByteArray bytes)

Writes a ByteArray to this instance.

Parameters
bytes:ByteArray

non-null; the array to write

writeback to summary
public void write(byte[] bytes, int offset, int length)

Writes a portion of a byte[] to this instance.

Parameters
bytes:byte[]

non-null; the array to write

offset:int

>= 0; offset into bytes for the first byte to write

length:int

>= 0; number of bytes to write

writeback to summary
public void write(byte[] bytes)

Writes a byte[] to this instance. This is just a convenient shorthand for write(bytes, 0, bytes.length).

Parameters
bytes:byte[]

non-null; the array to write

writeByteback to summary
public void writeByte(int value)

Redeclares org.droidparts.dexmaker.dx.util.ByteOutput.writeByte.

Writes a byte to this instance.

Parameters
value:int

the value to write; all but the low 8 bits are ignored

writeIntback to summary
public void writeInt(int value)

Writes an int to this instance.

Parameters
value:int

the value to write

writeLongback to summary
public void writeLong(long value)

Writes a long to this instance.

Parameters
value:long

the value to write

writeShortback to summary
public void writeShort(int value)

Writes a short to this instance.

Parameters
value:int

the value to write; all but the low 16 bits are ignored

writeSleb128back to summary
public int writeSleb128(int value)

Writes a DWARFv3-style unsigned LEB128 integer. For details, see the "Dalvik Executable Format" document or DWARF v3 section 7.6.

Parameters
value:int

value to write

Returns:int

1..5; the number of bytes actually written

writeUleb128back to summary
public int writeUleb128(int value)

Writes a DWARFv3-style unsigned LEB128 integer. For details, see the "Dalvik Executable Format" document or DWARF v3 section 7.6.

Parameters
value:int

value to write, treated as an unsigned value

Returns:int

1..5; the number of bytes actually written

writeZeroesback to summary
public void writeZeroes(int count)

Writes the given number of 0 bytes.

Parameters
count:int

>= 0; the number of zeroes to write