PickleBuffer

dotty.tools.dotc.core.unpickleScala2.PickleBuffer
See thePickleBuffer companion object
class PickleBuffer(data: Array[Byte], from: Int, to: Int)

Variable length byte arrays, with methods for basic pickling and unpickling.

Value parameters

data

The initial buffer

from

The first index where defined data are found

to

The first index where new data can be written

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Concrete methods

Pickle = majorVersion_Nat minorVersion_Nat nbEntries_Nat {Entry} Entry = type_Nat length_Nat [actual entries]

Pickle = majorVersion_Nat minorVersion_Nat nbEntries_Nat {Entry} Entry = type_Nat length_Nat [actual entries]

Assumes that the ..Version_Nat are already consumed.

Attributes

Returns

an array mapping entry numbers to locations in the byte array where the entries start.

def ensureCapacity(capacity: Int): Unit
def patchNat(pos: Int, x: Int): Unit

Write a natural number x at position pos. If number is more than one byte, shift rest of array to make space.

Write a natural number x at position pos. If number is more than one byte, shift rest of array to make space.

Value parameters

pos

...

x

...

Attributes

def peekByte(): Int

Peek at the current byte without moving the read index

Peek at the current byte without moving the read index

Attributes

def readByte(): Int

Read a byte

Read a byte

Attributes

def readLong(len: Int): Long

Read a long number in signed big endian format, base 256.

Read a long number in signed big endian format, base 256.

Attributes

def readLongNat(): Long
def readNat(): Int

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

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

Attributes

def times[T](n: Int, op: () => T): List[T]

Perform operation op the number of times specified. Concatenate the results into a list.

Perform operation op the number of times specified. Concatenate the results into a list.

Attributes

Returns the buffer as a sequence of (Int, Array[Byte]) representing (tag, data) of the individual entries. Saves and restores buffer state.

Returns the buffer as a sequence of (Int, Array[Byte]) representing (tag, data) of the individual entries. Saves and restores buffer state.

Attributes

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

Perform operation op until the condition readIndex == end is satisfied. Concatenate results into a list.

Perform operation op until the condition readIndex == end is satisfied. Concatenate results into a list.

Value parameters

end

...

op

...

Attributes

Returns

...

def writeByte(b: Int): Unit

Write a byte of data

Write a byte of data

Attributes

def writeLong(x: Long): Unit

Write a long number x in signed big endian format, base 256.

Write a long number x in signed big endian format, base 256.

Value parameters

x

The long number to be written.

Attributes

Like writeNat, but for longs. This is not the same as writeLong, which writes in base 256. Note that the binary representation of LongNat is identical to Nat if the long value is in the range Int.MIN_VALUE to Int.MAX_VALUE.

Like writeNat, but for longs. This is not the same as writeLong, which writes in base 256. Note that the binary representation of LongNat is identical to Nat if the long value is in the range Int.MIN_VALUE to Int.MAX_VALUE.

Attributes

def writeNat(x: Int): Unit

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

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

Attributes

Concrete fields

var bytes: Array[Byte]
var readIndex: Int