IByteReader

Description

interface Tinman.Core.IO.IByteReader

Derived from

IPathInfo

Extended by

IBinaryReader

Base interface for classes that sequentially read data from a binary stream.

The methods of this interface read single-byte values which are not affected by byte order.

Public / Methods

Read


public method Read → (1)

bytes in : ByteBuffer

[not-null]
The buffer where the read bytes will be stored.

returns → int32

The number of bytes that have been read.

Reads a number of bytes from the stream.

The number of bytes that are read from the stream may be less than the number of ByteBuffer.Remaining bytes in the given ByteBuffer, for any arbitrary reason.

IOException

If an I/O error has occurred.

Read​Bools


public method ReadBools → (3)

array in : bool [ ]

[not-null]
The output array.

offset in : int32

[>=0]
Index of first array element to write.

count in : int32

[>=0]
Number of values to read.

Reads 8-bit boolean values from the stream.

Calling this method is equivalent to calling IByteReader.ReadBool sequentially for each element in the given array in segment but may be implemented in a more efficient way.

IOException

If an I/O error has occurred.

Read​Int8


public method ReadInt8 → ()

returns → int8

The read value.

Reads a signed 8-bit value from the stream.

IOException

If an I/O error has occurred.

Read​Int8s


public method ReadInt8s → (3)

array in : int8 [ ]

[not-null]
The output array.

offset in : int32

[>=0]
Index of first array element to write.

count in : int32

[>=0]
Number of values to read.

Reads signed 8-bit integer values from the stream.

Calling this method is equivalent to calling ReadInt8 sequentially for each element in the given array in segment but may be implemented in a more efficient way.

IOException

If an I/O error has occurred.

Skip


public method Skip → (1)

count in : int64

[>=0]
The number of bytes to skip.

Skips reading of the given number of bytes.

IOException

If an I/O error has occurred.

Try​Read​UInt8


public method TryReadUInt8 → ()

returns → int32

The read value or -1 if the end of the stream has been reached.

Tries to read an unsigned 8-bit integer value from the stream.

IOException

If an I/O error has occurred.

Extensions

Read​All


public static method ReadAll → (1)

bytes in : ByteBuffer

[not-null]
The buffer where the read bytes will be stored.

Reads a number of bytes from the stream.

The number of bytes that are read from the stream will be equal to the number of ByteBuffer.Remaining bytes in the given ByteBuffer.

IOException

If an I/O error has occurred.

Read​Bool


public static method ReadBool → ()

returns → bool

false if the read value is equal to 0 and true otherwise.

Reads an 8-bit boolean value from the stream.

IOException

If an I/O error has occurred.

Read​Eof


public static method ReadEof → (1)

bytes in : ByteBuffer

[not-null]
The buffer where the read bytes will be stored.

returns → int32

The number of bytes that have been read into bytes in. A value of 0 indicates that the end of file has been reached (assuming bytes in had at least one remaining byte).

Reads a number of bytes from the stream.

The number of bytes that are read from the stream will be equal to the number of ByteBuffer.Remaining bytes in the given ByteBuffer, except when the end of file is reached (the returned value will be smaller in this case).

IOException

If an I/O error has occurred.

Read​Int16_​BE


public static method ReadInt16_BE → ()

returns → int16

The read value.

Reads a big-endian 16-bit signed integer from the stream.

IOException

If an I/O error has occurred.

Read​Int16_​LE


public static method ReadInt16_LE → ()

returns → int16

The read value.

Reads a little-endian 16-bit signed integer from the stream.

IOException

If an I/O error has occurred.

Read​Int32_​BE


public static method ReadInt32_BE → ()

returns → int32

The read value.

Reads a big-endian 32-bit signed integer from the stream.

IOException

If an I/O error has occurred.

Read​Int32_​LE


public static method ReadInt32_LE → ()

returns → int32

The read value.

Reads a little-endian 32-bit signed integer from the stream.

IOException

If an I/O error has occurred.

Read​Int64_​BE


public static method ReadInt64_BE → ()

returns → int64

The read value.

Reads a big-endian 64-bit signed integer from the stream.

IOException

If an I/O error has occurred.

Read​Int64_​LE


public static method ReadInt64_LE → ()

returns → int64

The read value.

Reads a little-endian 64-bit signed integer from the stream.

IOException

If an I/O error has occurred.

Read​UInt8


public static method ReadUInt8 → ()

returns → int32

The read value.

Reads an unsigned 8-bit integer value from the stream.

This method is equivalent to IByteReader.ReadInt8, except that it applies the bitmask 0xFF to the read value, before returning it. It does not choose a different binary encoding in the first place.

IOException

If an I/O error has occurred.

Read​UTF8


public static method ReadUTF8 → (1)

length in : int32

The length of the code unit sequence.

returns → string

The read string or null iff length in is negative.

Reads a string from the given sequence of UTF-8 code units.

IOException

If an I/O error has occurred.

Read​Var​Int32


public static method ReadVarInt32 → ()

returns → int32

The read value.

Reads a 32-bit value from the stream, using variable coding from one to five bytes.

The encoding is independent on byte endianness.

IOException

If an I/O error has occurred.

Read​Var​Int64


public static method ReadVarInt64 → (1)

shortcut opt : bool = true

Use shortcut coding?

returns → int64

The read value.

Reads a 64-bit value from the stream, using variable coding from one to nine (with shortcut opt coding) or ten (without shortcut opt coding) bytes.

The encoding is independent on byte endianness.

IOException

If an I/O error has occurred.

Read​Var​UInt32


public static method ReadVarUInt32 → ()

returns → int32

The read value.

Reads a 32-bit value from the stream, using variable coding from one to five bytes.

The encoding is independent on byte endianness.

IOException

If an I/O error has occurred.

Read​Var​UInt64


public static method ReadVarUInt64 → (1)

shortcut opt : bool = true

Use shortcut coding?

returns → int64

The read value.

Reads a 64-bit value from the stream, using variable coding from one to nine (with shortcut opt coding) or ten (without shortcut opt coding) bytes.

The encoding is independent on byte endianness.

IOException

If an I/O error has occurred.