类 CSVParser

java.lang.Object
com.sh.common.csv.CSVParser

public class CSVParser extends Object
Description: CSV文件解析 Title:首亨软件 - CRM、TSS、ERP等信息化管理软件
  • 字段详细资料

    • DEFAULT_SEPARATOR

      public static final char DEFAULT_SEPARATOR
      另请参阅:
    • INITIAL_READ_SIZE

      public static final int INITIAL_READ_SIZE
      另请参阅:
    • DEFAULT_QUOTE_CHARACTER

      public static final char DEFAULT_QUOTE_CHARACTER
      另请参阅:
    • DEFAULT_ESCAPE_CHARACTER

      public static final char DEFAULT_ESCAPE_CHARACTER
      另请参阅:
    • DEFAULT_STRICT_QUOTES

      public static final boolean DEFAULT_STRICT_QUOTES
      另请参阅:
    • DEFAULT_IGNORE_LEADING_WHITESPACE

      public static final boolean DEFAULT_IGNORE_LEADING_WHITESPACE
      另请参阅:
    • NULL_CHARACTER

      public static final char NULL_CHARACTER
      另请参阅:
  • 构造器详细资料

    • CSVParser

      public CSVParser()
      默认构造函数
    • CSVParser

      public CSVParser(char separator)
      Constructs CSVParser with supplied separator.
      参数:
      separator - 分隔符
    • CSVParser

      public CSVParser(char separator, char quotechar)
      Constructs CSVParser with supplied separator and quote char.
      参数:
      separator - the delimiter to use for separating entries
      quotechar - the character to use for quoted elements
    • CSVParser

      public CSVParser(char separator, char quotechar, char escape)
      Constructs CSVReader with supplied separator and quote char.
      参数:
      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
    • CSVParser

      public CSVParser(char separator, char quotechar, char escape, boolean strictQuotes)
      Constructs CSVReader with supplied separator and quote char. Allows setting the "strict quotes" flag
      参数:
      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
      strictQuotes - if true, characters outside the quotes are ignored
    • CSVParser

      public CSVParser(char separator, char quotechar, char escape, boolean strictQuotes, boolean ignoreLeadingWhiteSpace)
      Constructs CSVReader with supplied separator and quote char. Allows setting the "strict quotes" and "ignore leading whitespace" flags
      参数:
      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
      strictQuotes - if true, characters outside the quotes are ignored
      ignoreLeadingWhiteSpace - if true, white space in front of a quote in a field is ignored
  • 方法详细资料

    • isPending

      public boolean isPending()
      返回:
      true if something was left over from last call(s)
    • parseLineMulti

      public String[] parseLineMulti(String nextLine) throws IOException
      抛出:
      IOException
    • parseLine

      public String[] parseLine(String nextLine) throws IOException
      抛出:
      IOException
    • isNextCharacterEscapable

      protected boolean isNextCharacterEscapable(String nextLine, boolean inQuotes, int i)
      precondition: the current character is an escape
      参数:
      nextLine - the current line
      inQuotes - true if the current context is quoted
      i - current index in line
      返回:
      true if the following character is a quote
    • isAllWhiteSpace

      protected boolean isAllWhiteSpace(CharSequence sb)
      precondition: sb.length() > 0
      参数:
      sb - A sequence of characters to examine
      返回:
      true if every character in the sequence is whitespace