IOUtil

Description

static class Tinman.Core.IO.IOUtil

Helper class for this namespace.

This class provides some helper methods, dealing with the following:

  • Base-85 coding of binary data, see FromBase85 and ToBase85.

  • Asynchronous flushing, see TaskFlush

  • Read and write 64-bit integer values using minimal byte count (between 1 and 9), see VarInt*.

Public / Methods

From​Base85


public static method FromBase85 → (1)

data in : string

[not-null]
The base-85 encoded string.

returns → int8 [ ]

The decoded binary data.

Decodes binary data from the given base-85 encoded string.

IOException

If data in is malformed.

See also

IOUtil.ToBase85

Task​Flush


public static method TaskFlush → (1)

parallel in : bool

Use parallel tasks for flushing? A parallel flush uses TaskPool.Parallelism background tasks to perform the flush.

returns → ITaskVoid<IFlushable>

The created ITaskVoid object.

A task that flushes the given object.

See also

IFlushable.Flush

To​Base85


public static method ToBase85 → (3)

data in : int8 [ ]

[not-null]
The binary data.

offset in : int32

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

count in : int32

[>=0]
Number of values to write.

returns → string

The base-85 encoded string.

Encodes the given binary data as base-85.

Var​Int​Length


[Pure]
public static method VarIntLength → (1)

value in : int64

The value to encode.

returns → int32

The number of required bytes.

Returns the number of bytes that are required to encode the given value using variable coding from one to nine bytes.

Var​Int​Read

2 overloads


public static method VarIntRead1 → (1)

stream in : IBinaryReader

[not-null]
The input data stream.

returns → int64

The read value.

Reads a signed 64-bit value from the IDataStream using variable coding from one to nine bytes.

The encoding is independent on byte endianness.

IOException

If an I/O error has occurred.


public static method VarIntRead2 → (1)

buffer in : ByteBuffer

[not-null]
The input byte buffer.

returns → int64

The read value.

Reads a signed 64-bit value from the ByteBuffer using variable coding from one to nine bytes.

The encoding is independent on byte endianness.

Var​Int​Write

2 overloads


public static method VarIntWrite1 → (2)

stream in : IBinaryWriter

[not-null]
The output stream.

value in : int64

The value to write.

Writes a signed 64-bit value to the IDataStream using variable coding from one to nine bytes.

The encoding is independent on byte endianness.

IOException

If an I/O error has occurred.


public static method VarIntWrite2 → (2)

buffer in : ByteBuffer

[not-null]
The output byte buffer.

value in : int64

The value to write.

Writes a signed 64-bit value to the ByteBuffer using variable coding from one to nine bytes.

The encoding is independent on byte endianness.