booster / com.didiglobal.booster.aapt2 / BinaryParser

BinaryParser

class BinaryParser : Closeable

Represents a binary data parser

Author
johnsonlee

Constructors

<init>

Initialize with the specified buffer

BinaryParser(buffer: ByteBuffer)
BinaryParser(buffer: ByteArray)

Initialize with the specified file and byte order

BinaryParser(file: File, order: ByteOrder = ByteOrder.LITTLE_ENDIAN)

Initialize with the specified input stream and byte order

BinaryParser(input: InputStream, order: ByteOrder = ByteOrder.LITTLE_ENDIAN)

Properties

capacity

The capacity of buffer

val capacity: Int

hasRemaining

Tells whether there are any elements between the current position and the limit.

val hasRemaining: Boolean

remaining

The remaining size of buffer

val remaining: Int

Functions

close

fun close(): Unit

getByte

Returns a byte value at the specified index

fun getByte(index: Int): Byte

getBytes

fun getBytes(size: Int, index: Int): ByteArray

getChar

fun getChar(index: Int): Char

getInt

fun getInt(index: Int): Int

getLong

fun getLong(index: Int): Long

getShort

Returns a short value at the specified index

fun getShort(index: Int): Short

getUByte

fun getUByte(index: Int): Int

getUInt

fun getUInt(index: Int): Int

getUShort

fun getUShort(index: Int): Int

parse

Parses the remaining data in buffer as the specified type

fun <T> parse(handler: (ByteBuffer) -> T): T

readByte

Returns the next byte

fun readByte(): Byte

readBytes

fun readBytes(size: Int): ByteArray

readChar

fun readChar(): Char

readInt

fun readInt(): Int

readLong

fun readLong(): Long

readShort

Returns the next short

fun readShort(): Short

readSleb128

fun readSleb128(): Int

readUByte

fun readUByte(): Int

readUInt

fun readUInt(): Int

readUleb128

fun readUleb128(): Int

readUShort

fun readUShort(): Int

seek

fun seek(pos: Int): ByteBuffer!

skip

fun skip(n: Int): ByteBuffer!

tell

fun tell(): Int

Extension Functions

parseAapt2Container

fun BinaryParser.parseAapt2Container(): Aapt2Container

parseConfiguration

fun BinaryParser.parseConfiguration(): Configuration

parseHeader

fun BinaryParser.parseHeader(): Header

parseResEntry

fun BinaryParser.parseResEntry(): Entry<*>