class TastyReader

A byte array buffer that can be filled with bytes or natural numbers in TASTY format, and that supports reading and patching addresses represented as natural numbers.

Constructors

TastyReader ( bytes: Array [ Byte ] , start: Int , end: Int , base: Int )
TastyReader ( bytes: Array [ Byte ] )

Members

val base : Int
private var bp : Int
val bytes : Array [ Byte ]
private val end : Int
private val start : Int
def addr ( idx: Int ) : R
private def bp_= ( x$1: Int ) : Unit
def collectWhile ( cond: => Boolean ) ( op: => T ) : List [ T ]

Perform op while cindition cond holds and collect results in a list.

Perform op while cindition cond holds and collect results in a list.

def currentAddr : Addr

The address of the next byte to read

The address of the next byte to read

def endAddr : Addr

the address one greater than the last brte to read

the address one greater than the last brte to read

def goto ( addr: Addr ) : Unit

Set read position to the one pointed to by addr

Set read position to the one pointed to by addr

def ifBefore ( end: Addr ) ( op: => T , default: T ) : T

If before given end address, the result of op, otherwise default

If before given end address, the result of op, otherwise default

def index ( addr: Addr ) : Int
def isAtEnd : Boolean

Have all bytes been read?

Have all bytes been read?

def nextByte : Int

Returns the next byte of data as a natural number without advancing the read position

Returns the next byte of data as a natural number without advancing the read position

def readAddr ( ) : R

Read a natural number and return as an address

Read a natural number and return as an address

def readByte ( ) : Int

Read a byte of data.

Read a byte of data.

def readBytes ( n: Int ) : Array [ Byte ]

Read the next n bytes of data.

Read the next n bytes of data.

def readEnd ( ) : Addr

Read a length number and return the absolute end address implied by it, given as 

 + .

Read a length number and return the absolute end address implied by it, given as 

 + .

def readInt ( ) : Int

Read an integer number in 2's complement big endian format, base 128. All but the last digits have bit 0x80 set.

Read an integer number in 2's complement big endian format, base 128. All but the last digits have bit 0x80 set.

def readLongInt ( ) : Long

Read a long integer number in 2's complement big endian format, base 128.

Read a long integer number in 2's complement big endian format, base 128.

def readLongNat ( ) : Long

Read a natural number fitting in a Long in big endian format, base 128. All but the last digits have bit 0x80 set.

Read a natural number fitting in a Long in big endian format, base 128. All but the last digits have bit 0x80 set.

def readNameRef ( ) : R

Read a natural number and return as a NameRef

Read a natural number and return as a NameRef

def readNat ( ) : Int

Read a natural number fitting in an Int in big endian format, base 128. All but the last digits have bit 0x80 set.

Read a natural number fitting in an Int in big endian format, base 128. All but the last digits have bit 0x80 set.

def readUncompressedLong ( ) : Long

Read an uncompressed Long stored in 8 bytes in big endian format

Read an uncompressed Long stored in 8 bytes in big endian format

def startAddr : Addr

The address of the first byte to read, respectively byte that was read

The address of the first byte to read, respectively byte that was read

def subReader ( start: Addr , end: Addr ) : TastyReader

A new reader over the same array with the same address base, but with specified start and end positions

A new reader over the same array with the same address base, but with specified start and end positions

def until ( end: Addr ) ( op: => T ) : List [ T ]

Perform op until end address is reached and collect results in a list.

Perform op until end address is reached and collect results in a list.