Documentation of 'jhplot.io.csv.CSVReader' Java class.
CSVReader
jhplot.io.csv

Class CSVReader

    • Field Summary

      Fields 
      Modifier and TypeField and Description
      static intDEFAULT_SKIP_LINES
      The default line to start reading.
    • Constructor Summary

      Constructors 
      Constructor and Description
      CSVReader(BufferedReader reader, char separator)
      Constructs CSVReader with supplied separator.
      CSVReader(BufferedReader reader, char separator, char quotechar, char escape, int line, boolean strictQuotes, boolean ignoreLeadingWhiteSpace)
      Constructs CSVReader with supplied separator and quote char.
      CSVReader(File file, char separator)
      Constructs CSVReader with supplied separator.
      CSVReader(Reader reader)
      Constructs CSVReader using a comma for the separator.
      CSVReader(Reader reader, char separator)
      Constructs CSVReader with supplied separator.
      CSVReader(Reader reader, char separator, char quotechar)
      Constructs CSVReader with supplied separator and quote char.
      CSVReader(Reader reader, char separator, char quotechar, boolean strictQuotes)
      Constructs CSVReader with supplied separator, quote char and quote handling behavior.
      CSVReader(Reader reader, char separator, char quotechar, char escape)
      Constructs CSVReader with supplied separator and quote char.
      CSVReader(Reader reader, char separator, char quotechar, char escape, int line)
      Constructs CSVReader with supplied separator and quote char.
      CSVReader(Reader reader, char separator, char quotechar, char escape, int line, boolean strictQuotes)
      Constructs CSVReader with supplied separator and quote char.
      CSVReader(Reader reader, char separator, char quotechar, char escape, int line, boolean strictQuotes, boolean ignoreLeadingWhiteSpace)
      Constructs CSVReader with supplied separator and quote char.
      CSVReader(Reader reader, char separator, char quotechar, int line)
      Constructs CSVReader with supplied separator and quote char.
      CSVReader(String file, char separator)
      Constructs CSVReader with supplied separator.
      CSVReader(String file, char separator, char quotechar)
      Constructs CSVReader with supplied separator and quote char.
      CSVReader(URL url, char separator)
      Constructs CSVReader with supplied separator.
    • Field Detail

      • DEFAULT_SKIP_LINES

        public static final int DEFAULT_SKIP_LINES
        The default line to start reading.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CSVReader

        public CSVReader(Reader reader)
        Constructs CSVReader using a comma for the separator.
        Parameters:
        reader - the reader to an underlying CSV source.
      • CSVReader

        public CSVReader(Reader reader,                 char separator)
        Constructs CSVReader with supplied separator.
        Parameters:
        reader - the reader to an underlying CSV source.
        separator - the delimiter to use for separating entries.
      • CSVReader

        public CSVReader(String file,                 char separator)          throws Exception
        Constructs CSVReader with supplied separator.
        Parameters:
        file - file
        separator - the delimiter to use for separating entries.
        Throws:
        Exception
      • CSVReader

        public CSVReader(File file,                 char separator)          throws Exception
        Constructs CSVReader with supplied separator.
        Parameters:
        file - URL file URL
        separator - the delimiter to use for separating entries.
        Throws:
        Exception
      • CSVReader

        public CSVReader(URL url,                 char separator)          throws Exception
        Constructs CSVReader with supplied separator.
        Parameters:
        file - URL file URL
        separator - the delimiter to use for separating entries.
        Throws:
        Exception
      • CSVReader

        public CSVReader(BufferedReader reader,                 char separator)
        Constructs CSVReader with supplied separator.
        Parameters:
        reader - the reader to an underlying CSV source.
        separator - the delimiter to use for separating entries.
      • CSVReader

        public CSVReader(Reader reader,                 char separator,                 char quotechar)
        Constructs CSVReader with supplied separator and quote char.
        Parameters:
        reader - the reader to an underlying CSV source.
        separator - the delimiter to use for separating entries
        quotechar - the character to use for quoted elements
      • CSVReader

        public CSVReader(String file,                 char separator,                 char quotechar)          throws Exception
        Constructs CSVReader with supplied separator and quote char.
        Parameters:
        reader - the reader to an underlying CSV source.
        separator - the delimiter to use for separating entries
        quotechar - the character to use for quoted elements
        Throws:
        Exception
      • CSVReader

        public CSVReader(Reader reader,                 char separator,                 char quotechar,                 boolean strictQuotes)
        Constructs CSVReader with supplied separator, quote char and quote handling behavior.
        Parameters:
        reader - the reader to an underlying CSV source.
        separator - the delimiter to use for separating entries
        quotechar - the character to use for quoted elements
        strictQuotes - sets if characters outside the quotes are ignored
      • CSVReader

        public CSVReader(Reader reader,                 char separator,                 char quotechar,                 char escape)
        Constructs CSVReader with supplied separator and quote char.
        Parameters:
        reader - the reader to an underlying CSV source.
        separator - the delimiter to use for separating entries
        quotechar - the character to use for quoted elements
        escape - the character to use for escaping a separator or quote
      • CSVReader

        public CSVReader(Reader reader,                 char separator,                 char quotechar,                 int line)
        Constructs CSVReader with supplied separator and quote char.
        Parameters:
        reader - the reader to an underlying CSV source.
        separator - the delimiter to use for separating entries
        quotechar - the character to use for quoted elements
        line - the line number to skip for start reading
      • CSVReader

        public CSVReader(Reader reader,                 char separator,                 char quotechar,                 char escape,                 int line)
        Constructs CSVReader with supplied separator and quote char.
        Parameters:
        reader - the reader to an underlying CSV source.
        separator - the delimiter to use for separating entries
        quotechar - the character to use for quoted elements
        escape - the character to use for escaping a separator or quote
        line - the line number to skip for start reading
      • CSVReader

        public CSVReader(Reader reader,                 char separator,                 char quotechar,                 char escape,                 int line,                 boolean strictQuotes)
        Constructs CSVReader with supplied separator and quote char.
        Parameters:
        reader - the reader to an underlying CSV source.
        separator - the delimiter to use for separating entries
        quotechar - the character to use for quoted elements
        escape - the character to use for escaping a separator or quote
        line - the line number to skip for start reading
        strictQuotes - sets if characters outside the quotes are ignored
      • CSVReader

        public CSVReader(Reader reader,                 char separator,                 char quotechar,                 char escape,                 int line,                 boolean strictQuotes,                 boolean ignoreLeadingWhiteSpace)
        Constructs CSVReader with supplied separator and quote char.
        Parameters:
        reader - the reader to an underlying CSV source.
        separator - the delimiter to use for separating entries
        quotechar - the character to use for quoted elements
        escape - the character to use for escaping a separator or quote
        line - the line number to skip for start reading
        strictQuotes - sets if characters outside the quotes are ignored
        ignoreLeadingWhiteSpace - it true, parser should ignore white space before a quote in a field
      • CSVReader

        public CSVReader(BufferedReader reader,                 char separator,                 char quotechar,                 char escape,                 int line,                 boolean strictQuotes,                 boolean ignoreLeadingWhiteSpace)
        Constructs CSVReader with supplied separator and quote char.
        Parameters:
        reader - the reader to an underlying CSV source.
        separator - the delimiter to use for separating entries
        quotechar - the character to use for quoted elements
        escape - the character to use for escaping a separator or quote
        line - the line number to skip for start reading
        strictQuotes - sets if characters outside the quotes are ignored
        ignoreLeadingWhiteSpace - it true, parser should ignore white space before a quote in a field
    • Method Detail

      • readAll

        public List<String[]> readAll()                       throws IOException
        Reads the entire file into a List with each element being a String[] of tokens.
        Returns:
        a List of String[], with each String[] representing a line of the file.
        Throws:
        IOException - if bad things happen during the read
      • readNext

        public String[] readNext()                  throws IOException
        Reads the next line from the buffer and converts to a string array.
        Returns:
        a string array with each comma-separated element as a separate entry.
        Throws:
        IOException - if bad things happen during the read
      • next

        public String[] next()              throws IOException
        Reads the next line from the buffer and converts to a string array. Same as getNextLine().
        Returns:
        a string array with each comma-separated element as a separate entry.
        Throws:
        IOException - if bad things happen during the read

DMelt 2.7 © DataMelt by jWork.ORG