Object - io : ReadableCSVChannel

Represents a ReadableCSVChannel which could be used to read records from CSV file.

Constructor

__init

(ReadableCharacterChannel byteChannel, Separator fs, int nHeaders)

  • fs Separator ,
  • Field separator, which will separate between the records in the CSV file

  • nHeaders int 0
  • Number of headers, which should be skipped prior to reading records

Methods

hasNext

()

returns boolean

Indicates whether there's another record which could be read.

  • Return Type

    (boolean)
  • True if there's a record

getNext

()

returns string[] | error | ()

Gets the next record from the CSV file.

  • Return Type

    (string[] | error | ())
  • List of fields in the CSV or error

close

()

returns error?

Closes a given CSVChannel.

  • Return Type

    (error?)
  • Returns if an error is encountered

getTable

(typedesc structType)

returns table | error

Returns a table which corresponds to the CSV records.

Parameters

  • structType typedesc
  • The object the CSV records should be deserialized

  • Return Type

    (table | error)
  • Table which represents CSV records or error