BinaryInput

io.github.vigoo.desert.BinaryInput

Interface for reading binary data

The low level read operations for primitive types must be implemented.

Also contains some higher level functions such as variable integer decoding and compression support, which have a default implementation based on the primitives.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Concise view

Value members

Abstract methods

def readByte(): Byte

Reads one byte from the input

Reads one byte from the input

Attributes

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

Reads N bytes from the input into an array

Reads N bytes from the input into an array

Attributes

count

Number of bytes to read

def readDouble(): Double

Reads a 64-bit floating point value from the input

Reads a 64-bit floating point value from the input

Attributes

def readFloat(): Float

Reads a 32-bit floating point value from the input

Reads a 32-bit floating point value from the input

Attributes

def readInt(): Int

Reads a 32-bit integer from the input

Reads a 32-bit integer from the input

Attributes

def readLong(): Long

Reads a 64-bit integer from the input

Reads a 64-bit integer from the input

Attributes

def readShort(): Short

Reads a 16-bit integer from the input

Reads a 16-bit integer from the input

Attributes

Concrete methods

def readCompressedByteArray(): Array[Byte]

Reads a compressed byte array from the input

Reads a compressed byte array from the input

It assumes to have two variable-length integer representing the uncompressed and the compressed data length followed by the ZIP-compressed array of bytes. Counterpart of BinaryOutput.writeCompressedByteArray

Attributes

def readVarInt(optimizeForPositive: Boolean): Int

Reads a variable-length encoded 32-bit integer from the input

Reads a variable-length encoded 32-bit integer from the input

The encoding takes 1-5 bytes.

Based on https://github.com/EsotericSoftware/kryo/blob/master/src/com/esotericsoftware/kryo/io/ByteBufferInput.java#L366

Attributes

optimizeForPositive

If true, the encoding was optimized for positive integers. This parameter must match the one passed to the BinaryOutput.writeVarInt