CSV Class

Provides static methods used to parse comma and tab delimited files

Constructors

There are no public constructors.

Properties

TAB_DELIMITER
COMMA_DELIMITER

Static Methods

getColumns( String row, String delimiter ) returns Columns
Returns column values for a given row
readLine( String data ) returns String
Returns a substring for the given data, ending at the first line break that is not inside a quote
readLine( java.io.InputStream is ) returns String
Returns a substring for the given data, ending at the first line break that is not inside a quote. Example usage:

      //Get input stream
        javaxt.io.File file; //create file!
        java.io.InputStream is = file.getInputStream();

      //Read header
        String header = CSV.readLine(is);
        int bom = CSV.getByteOrderMark(header);
        if (bom>-1) header = header.substring(bom);
        console.log(header);

      //Read rows
        String row;
        while (!(row=CSV.readLine(is)).isEmpty()){
            console.log(row);
        }

      //Close input stream
        is.close();     
getByteOrderMark( String str ) returns int
Returns end position of the Byte Order Mark (BOM). Example usage:
        int bom = CSV.getByteOrderMark(header);
        if (bom>-1) header = header.substring(bom);     
startsWithByteOrderMark( String str ) returns boolean
Returns true if the given string starts with a Byte Order Mark (BOM)

Public Classes