Class ExcelCSVParser

原文地址:http://ostermiller.org/utils/javadoc/ExcelCSVParser.html

The CSV that Excel outputs differs the format read by com.Ostermiller.util.CSVParser:

  • Leading and trailing whitespace is significant. 前導和尾隨空白是重要的。
  • A backslash is not a special character and is not used to escape anything. 反斜槓不是特殊字符,而不是用來轉義任何東西。
  • Quotes inside quoted strings are escaped with a double quote rather than a backslash.引號裏面引用字符串用雙引號而不是一個反斜槓。
  • Excel may convert data before putting it in CSV format:
    • Tabs are converted to a single space.
    • New lines in the data are always represented as the UNIX new line. ("\n")
    • Numbers that are greater than 12 digits may be represented in truncated scientific notation form.
    This parser does not attempt to fix these Excel conversions, but users should be aware of them.


Constructor Summary
ExcelCSVParser(InputStream in)
          Create a parser to parse comma separated values from an InputStream.
ExcelCSVParser(InputStream in, char delimiter)
          Create a parser to parse delimited values from an InputStream.
ExcelCSVParser(Reader in)
          Create a parser to parse comma separated values from a Reader.
ExcelCSVParser(Reader in, char delimiter)
          Create a parser to parse delimited values from a Reader.
 
Method Summary
 void changeDelimiter(char newDelim)
          Change this parser so that it uses a new delimiter.
 void changeQuote(char newQuote)
          Change this parser so that it uses a new character for quoting.
 void close()
          Close any stream upon which this parser is based.
 String[][] getAllValues()
          Get all the values from the file.
 int getLastLineNumber()
          Get the number of the line from which the last value was retrieved.
 String[] getLine()
          Get all the values from a line.
 int lastLineNumber()
          Get the line number that the last token came from.
 String nextValue()
          get the next value.
static String[][] parse(Reader in)
          Parse the comma delimited data from a stream.
static String[][] parse(Reader in, char delimiter)
          Parse the delimited data from a stream.
static String[][] parse(String s)
          Parse the comma delimited data from a string.
static String[][] parse(String s, char delimiter)
          Parse the delimited data from a string.
 void setCommentStart(String commentDelims)
          Set the characters that indicate a comment at the beginning of the line.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章