Object - io : WritableDataChannel

Represents a WritableDataChannel for writing data.

Constructor

__init

(WritableByteChannel byteChannel, ByteOrder bOrder)

Methods

Writes a 16 bit integer.
Writes a 32 bit integer.
Writes a 64 bit integer.
Writes a 32 bit float.
Writes a 64 bit float.
Writes a boolean.
Writes a given string value to the respective channel.
Writes a variable-length integer.
Closes the data channel.

writeInt16

(int value)

returns Error?

Writes a 16 bit integer.

 io: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

(int value)

returns Error?

Writes a 32 bit integer.

 io: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

(int value)

returns Error?

Writes a 64 bit integer.

 io: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

(float value)

returns Error?

Writes a 32 bit float.

 io: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

(float value)

returns Error?

Writes a 64 bit float.

 io: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

(boolean value)

returns Error?

Writes a boolean.

 io: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

(string value, string encoding)

returns Error?

Writes a given string value to the respective channel.

 io: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

(int value)

returns Error?

Writes a variable-length integer.

 io: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

()

returns Error?

Closes the data channel.

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

  • Return Type

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