Class: WritableDataChannel

Represents a WritableDataChannel for writing data.

Constructor

Initializes data channel.

init (WritableByteChannel byteChannel, ByteOrder bOrder)

Methods

writeInt16

Writes a 16 bit integer.

writeInt32

Writes a 32 bit integer.

writeInt64

Writes a 64 bit integer.

writeFloat32

Writes a 32 bit float.

writeFloat64

Writes a 64 bit float.

writeBool

Writes a boolean.

writeString

Writes a given string value to the respective channel.

writeVarInt

Writes a variable-length integer.

close

Closes the data channel.

writeInt16

function writeInt16(int value) returns Error?
Isolated Function

Writes a 16 bit integer.

1io:Error? err = dataChannel.writeInt16(length);

Parameters

  • value int
  • The integer, which will be written

Return Type

(Error?)

() if the content is written successfully or else an io:Error if any error occurred

writeInt32

function writeInt32(int value) returns Error?
Isolated Function

Writes a 32 bit integer.

1io:Error? err = dataChannel.writeInt32(length);

Parameters

  • value int
  • The integer, which will be written

Return Type

(Error?)

() if the content is written successfully or else io:Error if any error occurred

writeInt64

function writeInt64(int value) returns Error?
Isolated Function

Writes a 64 bit integer.

1io:Error? err = dataChannel.writeInt64(length);

Parameters

  • value int
  • The integer, which will be written

Return Type

(Error?)

() if the content is written successfully or else io:Error if any error occurred

writeFloat32

function writeFloat32(float value) returns Error?
Isolated Function

Writes a 32 bit float.

1io:Error? err = dataChannel.writeFloat32(3.12);

Parameters

  • value float
  • The float, which will be written

Return Type

(Error?)

() if the float is written successfully or else io:Error if any error occurred

writeFloat64

function writeFloat64(float value) returns Error?
Isolated Function

Writes a 64 bit float.

1io:Error? err = dataChannel.writeFloat32(3.12);

Parameters

  • value float
  • The float, which will be written

Return Type

(Error?)

() if the float is written successfully or else io:Error if any error occurred

writeBool

function writeBool(boolean value) returns Error?
Isolated Function

Writes a boolean.

1io:Error? err = dataChannel.writeInt64(length);

Parameters

  • value boolean
  • The boolean, which will be written

Return Type

(Error?)

() if the content is written successfully or else io:Error if any error occurred

writeString

function writeString(string value, string encoding) returns Error?
Isolated Function

Writes a given string value to the respective channel.

1io:Error? err = dataChannel.writeString(record);

Parameters

  • value string
  • The value, which should be written

  • encoding string
  • The encoding, which will represent the value string

Return Type

(Error?)

() if the content is written successfully or else io:Error if any error occurred

writeVarInt

function writeVarInt(int value) returns Error?
Isolated Function

Writes a variable-length integer.

1io:Error? err = dataChannel.writeVarInt(length);

Parameters

  • value int
  • The int, which will be written

Return Type

(Error?)

The value of the integer, which is written or else io:Error if any error occurred

close

function close() returns Error?
Isolated Function

Closes the data channel. After a channel is closed, any further writing operations will cause an error.

1io:Error? err = dataChannel.close();

Return Type

(Error?)

() if the channel is closed successfully or else io:Error if any error occurred