Object - io : WritableByteChannel

WritableByteChannel represents an output resource (i.e file). which could be used to sink bytes.

Methods

Sinks bytes from a given input/output resource.
Closes a given byte channel.

write

(byte[] content, int offset)

returns int | Error

Sinks bytes from a given input/output resource. This operation will be asynchronous. Writing might return without writing all the content.

 int|io:Error result = writableByteChannel.write(record, 0);

Parameters

  • content byte[]
  • Block of bytes, which should be written

  • offset int
  • Offset, which should be kept when writing bytes.

  • Return Type

    (int | Error)
  • Number of bytes written or else io:Error

close

()

returns Error?

Closes a given byte channel.

 io:Error err = writableByteChannel.close();

  • Return Type

    (Error?)
  • io:Error or else ()