Class TEoWriter

Unit

Declaration

type TEoWriter = class(TObject)

Description

A class for writing EO data to a sequence of bytes.

Hierarchy

Overview

Methods

Public constructor Create;
Public procedure AddByte(Value: Cardinal);
Public procedure AddBytes(const Bytes: TArray<Byte>);
Public procedure AddChar(Number: Cardinal);
Public procedure AddShort(Number: Cardinal);
Public procedure AddThree(Number: Cardinal);
Public procedure AddInt(Number: Cardinal);
Public procedure AddString(Str: string);
Public procedure AddFixedString(Str: string; ExpectedLength: Cardinal; Padded: Boolean = False); overload;
Public procedure AddEncodedString(Str: string);
Public procedure AddFixedEncodedString(Str: string; ExpectedLength: Cardinal; Padded: Boolean = False); overload;
Public function ToByteArray: TArray<Byte>;

Properties

Public property StringSanitizationMode: Boolean read FStringSanitizationMode write FStringSanitizationMode;
Public property Length: Cardinal read FLength;

Description

Methods

Public constructor Create;

Creates a new TEoWriter instance with no data.

Public procedure AddByte(Value: Cardinal);

Adds a raw byte to the writer data.

Parameters
Value
The byte to be added
Exceptions raised
EArgumentException
If the value is above $FF
Public procedure AddBytes(const Bytes: TArray<Byte>);

Adds an array of raw bytes to the writer data.

Parameters
Bytes
The array of bytes to be added
Public procedure AddChar(Number: Cardinal);

Adds an encoded 1-byte integer to the writer data.

Parameters
Number
The number to be encoded and added
Exceptions raised
EArgumentException
If the value is above EoCharMax
Public procedure AddShort(Number: Cardinal);

Adds an encoded 2-byte integer to the writer data.

Parameters
Number
The number to be encoded and added
Exceptions raised
EArgumentException
If the value is above EoShortMax
Public procedure AddThree(Number: Cardinal);

Adds an encoded 3-byte integer to the writer data.

Parameters
Number
The number to be encoded and added
Exceptions raised
EArgumentException
If the value is above EoThreeMax
Public procedure AddInt(Number: Cardinal);

Adds an encoded 4-byte integer to the writer data.

Parameters
Number
The number to be encoded and added
Exceptions raised
EArgumentException
If the value is above EoIntMax
Public procedure AddString(Str: string);

Adds a string to the writer data.

Parameters
Str
The string to be added
Public procedure AddFixedString(Str: string; ExpectedLength: Cardinal; Padded: Boolean = False); overload;

Adds a fixed-length string to the writer data.

Parameters
Str
The string to be added
Length
The expected length of the string
Padded
True if Str should be padded to Length with trailing $FF bytes
Exceptions raised
EArgumentException
If the string does not have the expected length
Public procedure AddEncodedString(Str: string);

Adds an encoded string to the writer data.

Parameters
Str
The string to be encoded and added
Public procedure AddFixedEncodedString(Str: string; ExpectedLength: Cardinal; Padded: Boolean = False); overload;

Adds a fixed-length encoded string to the writer data.

Parameters
Str
The string to be encoded and added
Length
The expected length of the string
Padded
True if Str should be padded to Length with trailing $FF bytes
Exceptions raised
EArgumentException
If the string does not have the expected length
Public function ToByteArray: TArray<Byte>;

Gets the writer data as a byte array.

Returns

A copy of the writer data as a byte array

Properties

Public property StringSanitizationMode: Boolean read FStringSanitizationMode write FStringSanitizationMode;

If string sanitization mode is enabled, the writer will switch $FF (ΓΏ) bytes in strings to $79 (y).

See:

Chunked Reading: Sanitization

Public property Length: Cardinal read FLength;

The length of the writer data.


Generated by PasDoc 0.16.0-snapshot.