Class TokenFileParser

java.lang.Object
uk.ac.gda.util.io.TokenFileParser

public class TokenFileParser extends Object
Read a tabbed delimited file into columns. Each row must have the same number of entries currently. Assumes that files are small. For larger files use StreamTokenizer(Reader r) which is more efficient.
  • Constructor Details

  • Method Details

    • parse

      public void parse() throws IOException
      Must be called to parse the file.
      Throws:
      IOException
    • getColumn

      public List<String> getColumn(int icol)
      Parameters:
      icol -
      Returns:
      the exact column, modifying it will change the data
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getColumnAsDoubleArray

      public Double[] getColumnAsDoubleArray(int i, int... ignoreRows)
      Exceptions can be thrown if the column cannot parse as double
      Parameters:
      i -
      Returns:
      Double[]
    • getColumnAsDoubleList

      public List<Double> getColumnAsDoubleList(int i, int... ignoreRows)
      Parameters:
      i -
      ignoreRows -
      Returns:
      column as list of Doubles
    • getToken

      public String getToken()
    • setToken

      public void setToken(String token)
    • getCommentChar

      public String getCommentChar()
    • setCommentChar

      public void setCommentChar(String commentChar)