Class: WritableTextRecordChannel

Represents a channel, which will allow to write records through a given WritableCharacterChannel.

Constructor

Constructs a DelimitedTextRecordChannel from a given WritableCharacterChannel.

init (WritableCharacterChannel characterChannel, string fs, string rs, string fmt)
  • characterChannel WritableCharacterChannel
  • The io:WritableCharacterChannel, which will point to the input/output resource

  • fs string ""
  • Field separator (this could be a regex)

  • rs string ""
  • Record separator (this could be a regex)

  • fmt string "default"
  • The format, which will be used to represent the CSV (this could be "DEFAULT" (the format specified by the CSVChannel), "CSV" (Field separator would be "," and record separator would be a new line) or else "TDF" (Field separator will be a tab and record separator will be a new line)

Methods

write

Writes records to a given output resource.

close

Closes the record channel.

write

function write(string[ ] textRecord) returns Error?
Isolated Function

Writes records to a given output resource.

1io:Error? err = writableChannel.write(records);

Parameters

  • textRecord string[ ]
  • List of fields to be written

Return Type

(Error?)

An io:Error if the records could not be written properly or else ()

close

function close() returns Error?
Isolated Function

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

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

Return Type

(Error?)

An io:Error if the record channel could not be closed properly or else ()