Packages

c

scala.tools.tasty

TastyReader

class TastyReader extends AnyRef

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.

Source
TastyReader.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TastyReader
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new TastyReader(bytes: Array[Byte])
  2. new TastyReader(bytes: Array[Byte], start: Int, end: Int, base: Int = 0)

    bytes

    The array containing data

    start

    The position from which to read

    end

    The position one greater than the last byte to be read

    base

    The index referenced by the logical zero address Addr(0)

Value Members

  1. def addr(idx: Int): Addr
  2. val base: Int
  3. val bytes: Array[Byte]
  4. def collectWhile[T](cond: => Boolean)(op: => T): List[T]

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

  5. def currentAddr: Addr

    The address of the next byte to read

  6. def doUntil(end: Addr)(op: => Unit): Unit
  7. def endAddr: Addr

    the address one greater than the last brte to read

  8. def goto(addr: Addr): Unit

    Set read position to the one pointed to by addr

  9. def ifBefore[T](end: Addr)(op: => T, default: T): T

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

  10. def index(addr: Addr): Int
  11. def isAtEnd: Boolean

    Have all bytes been read?

  12. def nextByte: Int

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

  13. def readAddr(): Addr

    Read a natural number and return as an address

  14. def readByte(): Int

    Read a byte of data.

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

    Read the next n bytes of data.

  16. 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

    + .

  17. def readInt(): Int

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

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

  18. def readLongInt(): Long

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

  19. def readLongNat(): Long

    Read a natural number fitting in a Long in big endian format, base 128.

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

  20. def readNameRef(): NameRef

    Read a natural number and return as a NameRef

  21. def readNat(): Int

    Read a natural number fitting in an Int in big endian format, base 128.

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

  22. def readUncompressedLong(): Long

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

  23. def startAddr: Addr

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

  24. 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

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

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