FileDocCategorySizeDatePackage
Output.javaAPI DocAndroid 5.1 API3971Thu Mar 12 22:18:30 GMT 2015com.android.dx.util

Output

public interface Output implements com.android.dex.util.ByteOutput
Interface for a sink for binary output. This is similar to {@code java.util.DataOutput}, but no {@code IOExceptions} are declared, and multibyte output is defined to be little-endian.

Fields Summary
Constructors Summary
Methods Summary
public voidalignTo(int alignment)
Adds extra bytes if necessary (with value {@code 0}) to force alignment of the output cursor as given.

param
alignment {@code > 0;} the alignment; must be a power of two

public voidassertCursor(int expectedCursor)
Asserts that the cursor is the given value.

param
expectedCursor the expected cursor value
throws
RuntimeException thrown if {@code getCursor() != expectedCursor}

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

return
{@code >= 0;} the cursor position

public voidwrite(byte[] bytes, int offset, int length)
Writes a portion of a {@code byte[]} to this instance.

param
bytes {@code non-null;} the array to write
param
offset {@code >= 0;} offset into {@code bytes} for the first byte to write
param
length {@code >= 0;} number of bytes to write

public voidwrite(byte[] bytes)
Writes a {@code byte[]} to this instance. This is just a convenient shorthand for {@code write(bytes, 0, bytes.length)}.

param
bytes {@code non-null;} the array to write

public voidwrite(ByteArray bytes)
Writes a {@link ByteArray} to this instance.

param
bytes {@code non-null;} the array to write

public voidwriteByte(int value)
Writes a {@code byte} to this instance.

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

public voidwriteInt(int value)
Writes an {@code int} to this instance.

param
value the value to write

public voidwriteLong(long value)
Writes a {@code long} to this instance.

param
value the value to write

public voidwriteShort(int value)
Writes a {@code short} to this instance.

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

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

param
value value to write
return
{@code 1..5;} the number of bytes actually written

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

param
value value to write, treated as an unsigned value
return
{@code 1..5;} the number of bytes actually written

public voidwriteZeroes(int count)
Writes the given number of {@code 0} bytes.

param
count {@code >= 0;} the number of zeroes to write