IProtonizer

Description

interface Tinman.Core.IO.Serialization.IProtonizer

Derived from

IBytePosition
ICanReadWrite
IPathInfo

Extended by

ProtonizerBase abstract

Base interface for classes that read and write data during conversion of IProtonizable objects to binary Protocol Buffers wire format streams.

Public / Methods

Read­Begin


public method ReadBegin → (1)

limit in : int64

The read limit of the stream. If negative, IBytePosition.Position plus the absolute value will be used as the read limit. If 0, the current Limit will be retained.

Imposes the given limit in for reading records from the wire stream.

Calls to ReadBegin and ReadEnd must be balanced and may be nested.

IOException

If an I/O error has occurred.

Read­End


public method ReadEnd → ()

Skips towards the read limit that has been imposed by the most recent call to ReadBegin.

IOException

If an I/O error has occurred.

Read­Record


public method ReadRecord → (1)

field opt : int32 = 0

[>=0]
The number of the field to read next or 0 to read the field that is next in the stream.

returns → Record

The Record to use for reading the payload. Will be Record.None if there are no more records because the Limit has been reached (when field opt is 0), there are no more records for the given field (when field opt is greater than 0) or field opt is -1.

Reads the tag of a record in a Protocol Buffers wire format stream.

Usually, records are consumed in the order in which they appear in the wire stream, where the reader inspects Record.Field and behaves accordingly. However, it may be necessary to consume the records with a specific field number in sequence. In that case, the IProtonizer may have to scan all records up to Limit and perform additional buffering.

If field opt has been 0 for the whole record sequence, the final call passing -1 may be omitted. If field opt has been greater than 0 one or more times, the final call must be made.

IOException

If an I/O error has occurred.

Write­Begin


public method WriteBegin → ()

returns → IProtonizer

The IProtonizer to use for deferred writing, which will have a IBytePosition.Position of 0.

Returns a IProtonizer object that can be used to write records in a Protocol Buffers wire format stream to a separate buffer, until WriteEnd is called.

IOException

If an I/O error has occurred.

Write­End


public method WriteEnd → ()

Fetches the content of the separate buffer that has been set up by the last call to WriteBegin and writes it to the wire format stream.

Calls to WriteBegin and WriteEnd must be balanced and may be nested.

IOException

If an I/O error has occurred.

Write­Record


public method WriteRecord → (2)

field in : int32

The field number.

type in : Wire

The wire type.

returns → Record

The Record to use for writing the payload.

Writes the tag of a record in a Protocol Buffers wire format stream.

IOException

If an I/O error has occurred.

Public / Attributes

Limit


public attribute Limit → (get)

value : int64

[>=]
The read limit.

Returns the current read limit of the stream.

The initial limit may be Maths.MaxLong, which may eventually cause an IOException with IOError.EndOfFile to be thrown.