public class ApacheCommonLogParser extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static char |
DEFAULT_ESCAPE_CHARACTER
The default escape character to use if none is supplied to the
constructor.
|
static boolean |
DEFAULT_IGNORE_LEADING_WHITESPACE
The default leading whitespace behavior to use if none is supplied to the
constructor
|
static char |
DEFAULT_QUOTE_CHARACTER
The default quote character to use if none is supplied to the
constructor.
|
static char[] |
DEFAULT_SEPARATOR
The default separators to use if none is supplied to the constructor.
|
static boolean |
DEFAULT_STRICT_QUOTES
The default strict quote behavior to use if none is supplied to the
constructor
|
static int |
INITIAL_READ_SIZE |
static char |
NULL_CHARACTER
This is the "null" character - if a value is set to this then it is ignored.
|
Constructor and Description |
---|
ApacheCommonLogParser()
Constructs CSVParser using a comma for the separator.
|
ApacheCommonLogParser(char[] separators)
Constructs CSVParser with supplied separator.
|
ApacheCommonLogParser(char[] separators,
char quotechar)
Constructs CSVParser with supplied separator and quote char.
|
ApacheCommonLogParser(char[] separators,
char quotechar,
char escape)
Constructs CSVReader with supplied separator and quote char.
|
ApacheCommonLogParser(char[] separators,
char quotechar,
char escape,
boolean strictQuotes)
Constructs CSVReader with supplied separator and quote char.
|
ApacheCommonLogParser(char[] separators,
char quotechar,
char escape,
boolean strictQuotes,
boolean ignoreLeadingWhiteSpace)
Constructs CSVReader with supplied separator and quote char.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
isAllWhiteSpace(CharSequence sb)
precondition: sb.length() > 0
|
protected boolean |
isNextCharacterEscapable(String nextLine,
boolean inQuotes,
int i)
precondition: the current character is an escape
|
boolean |
isPending() |
String[] |
parseLine(String nextLine) |
String[] |
parseLineMulti(String nextLine) |
boolean |
separatorChar(char c) |
public static final char[] DEFAULT_SEPARATOR
public static final int INITIAL_READ_SIZE
public static final char DEFAULT_QUOTE_CHARACTER
public static final char DEFAULT_ESCAPE_CHARACTER
public static final boolean DEFAULT_STRICT_QUOTES
public static final boolean DEFAULT_IGNORE_LEADING_WHITESPACE
public static final char NULL_CHARACTER
public ApacheCommonLogParser()
public ApacheCommonLogParser(char[] separators)
separators
- the delimiter to use for separating entries.public ApacheCommonLogParser(char[] separators, char quotechar)
separators
- the delimiter to use for separating entriesquotechar
- the character to use for quoted elementspublic ApacheCommonLogParser(char[] separators, char quotechar, char escape)
separators
- the delimiter to use for separating entriesquotechar
- the character to use for quoted elementsescape
- the character to use for escaping a separator or quotepublic ApacheCommonLogParser(char[] separators, char quotechar, char escape, boolean strictQuotes)
separators
- the delimiter to use for separating entriesquotechar
- the character to use for quoted elementsescape
- the character to use for escaping a separator or quotestrictQuotes
- if true, characters outside the quotes are ignoredpublic ApacheCommonLogParser(char[] separators, char quotechar, char escape, boolean strictQuotes, boolean ignoreLeadingWhiteSpace)
separators
- the delimiter to use for separating entriesquotechar
- the character to use for quoted elementsescape
- the character to use for escaping a separator or quotestrictQuotes
- if true, characters outside the quotes are ignoredignoreLeadingWhiteSpace
- if true, white space in front of a quote in a field is ignoredpublic boolean isPending()
public String[] parseLineMulti(String nextLine) throws IOException
IOException
public String[] parseLine(String nextLine) throws IOException
IOException
public boolean separatorChar(char c)
protected boolean isNextCharacterEscapable(String nextLine, boolean inQuotes, int i)
nextLine
- the current lineinQuotes
- true if the current context is quotedi
- current index in lineprotected boolean isAllWhiteSpace(CharSequence sb)
sb
- A sequence of characters to examineCopyright © 2014. All rights reserved.