@Contract(threading=IMMUTABLE) public class Tokenizer extends Object
This class is immutable and thread safe.
Modifier and Type | Class and Description |
---|---|
static class |
Tokenizer.Cursor |
static interface |
Tokenizer.Delimiter
Represents a predicate whether the given character is a delimiter.
|
Modifier and Type | Field and Description |
---|---|
static int |
CR |
static char |
DQUOTE
Double quote
|
static char |
ESCAPE
Backward slash / escape character
|
static int |
HT |
static Tokenizer |
INSTANCE |
static int |
LF |
static int |
SP |
Constructor and Description |
---|
Tokenizer() |
Modifier and Type | Method and Description |
---|---|
void |
copyContent(CharSequence buf,
Tokenizer.Cursor cursor,
BitSet bitSet,
StringBuilder dst)
Deprecated.
|
void |
copyContent(CharSequence buf,
Tokenizer.Cursor cursor,
Tokenizer.Delimiter delimiterPredicate,
StringBuilder dst)
Transfers content into the destination buffer until a whitespace character or any of
the given delimiters is encountered.
|
void |
copyQuotedContent(CharSequence buf,
Tokenizer.Cursor cursor,
StringBuilder dst)
Transfers content enclosed with quote marks into the destination buffer.
|
void |
copyUnquotedContent(CharSequence buf,
Tokenizer.Cursor cursor,
BitSet bitSet,
StringBuilder dst)
|
void |
copyUnquotedContent(CharSequence buf,
Tokenizer.Cursor cursor,
Tokenizer.Delimiter delimiterPredicate,
StringBuilder dst)
Transfers content into the destination buffer until a whitespace character, a quote,
or any of the given delimiters is encountered.
|
static Tokenizer.Delimiter |
delimiters(BitSet delimiters) |
static Tokenizer.Delimiter |
delimiters(char... delimiters) |
static Tokenizer.Delimiter |
delimiters(char delimiter) |
static Tokenizer.Delimiter |
delimiters(char delimiter1,
char delimiter2) |
static Tokenizer.Delimiter |
delimiters(char delimiter1,
char delimiter2,
char delimiter3) |
static BitSet |
INIT_BITSET(int... b)
Deprecated.
Do not use.
|
static boolean |
isWhitespace(char ch) |
String |
parseContent(CharSequence buf,
Tokenizer.Cursor cursor,
BitSet bitSet)
Deprecated.
|
String |
parseContent(CharSequence buf,
Tokenizer.Cursor cursor,
Tokenizer.Delimiter delimiterPredicate)
Extracts from the sequence of chars a token terminated with any of the given delimiters
or a whitespace characters.
|
String |
parseToken(CharSequence buf,
Tokenizer.Cursor cursor,
BitSet bitSet)
Deprecated.
|
String |
parseToken(CharSequence buf,
Tokenizer.Cursor cursor,
Tokenizer.Delimiter delimiterPredicate)
Extracts from the sequence of chars a token terminated with any of the given delimiters
discarding semantically insignificant whitespace characters.
|
String |
parseValue(CharSequence buf,
Tokenizer.Cursor cursor,
BitSet bitSet)
Deprecated.
|
String |
parseValue(CharSequence buf,
Tokenizer.Cursor cursor,
Tokenizer.Delimiter delimiterPredicate)
Extracts from the sequence of chars a value which can be enclosed in quote marks and
terminated with any of the given delimiters discarding semantically insignificant
whitespace characters.
|
void |
skipWhiteSpace(CharSequence buf,
Tokenizer.Cursor cursor)
Skips semantically insignificant whitespace characters and moves the cursor to the closest
non-whitespace character.
|
public static final char DQUOTE
public static final char ESCAPE
public static final int CR
public static final int LF
public static final int SP
public static final int HT
public static final Tokenizer INSTANCE
@Deprecated public static BitSet INIT_BITSET(int... b)
public static boolean isWhitespace(char ch)
public static Tokenizer.Delimiter delimiters(BitSet delimiters)
public static Tokenizer.Delimiter delimiters(char... delimiters)
public static Tokenizer.Delimiter delimiters(char delimiter)
public static Tokenizer.Delimiter delimiters(char delimiter1, char delimiter2)
public static Tokenizer.Delimiter delimiters(char delimiter1, char delimiter2, char delimiter3)
public String parseContent(CharSequence buf, Tokenizer.Cursor cursor, Tokenizer.Delimiter delimiterPredicate)
buf
- buffer with the sequence of chars to be parsedcursor
- defines the bounds and current position of the bufferdelimiterPredicate
- delimiter predicate. Can be null
if the token
is not delimited by any character.@Deprecated public String parseContent(CharSequence buf, Tokenizer.Cursor cursor, BitSet bitSet)
parseContent(CharSequence, Cursor, Delimiter)
public String parseToken(CharSequence buf, Tokenizer.Cursor cursor, Tokenizer.Delimiter delimiterPredicate)
buf
- buffer with the sequence of chars to be parsedcursor
- defines the bounds and current position of the bufferdelimiterPredicate
- delimiter predicate. Can be null
if the token
is not delimited by any character.@Deprecated public String parseToken(CharSequence buf, Tokenizer.Cursor cursor, BitSet bitSet)
parseToken(CharSequence, Cursor, Delimiter)
public String parseValue(CharSequence buf, Tokenizer.Cursor cursor, Tokenizer.Delimiter delimiterPredicate)
buf
- buffer with the sequence of chars to be parsedcursor
- defines the bounds and current position of the bufferdelimiterPredicate
- delimiter predicate. Can be null
if the token
is not delimited by any character.@Deprecated public String parseValue(CharSequence buf, Tokenizer.Cursor cursor, BitSet bitSet)
parseValue(CharSequence, Cursor, Delimiter)
public void skipWhiteSpace(CharSequence buf, Tokenizer.Cursor cursor)
buf
- buffer with the sequence of chars to be parsedcursor
- defines the bounds and current position of the bufferpublic void copyContent(CharSequence buf, Tokenizer.Cursor cursor, Tokenizer.Delimiter delimiterPredicate, StringBuilder dst)
buf
- buffer with the sequence of chars to be parsedcursor
- defines the bounds and current position of the bufferdelimiterPredicate
- delimiter predicate. Can be null
if the token
is delimited by a whitespace only.dst
- destination buffer@Deprecated public void copyContent(CharSequence buf, Tokenizer.Cursor cursor, BitSet bitSet, StringBuilder dst)
copyContent(CharSequence, Cursor, Delimiter, StringBuilder)
public void copyUnquotedContent(CharSequence buf, Tokenizer.Cursor cursor, Tokenizer.Delimiter delimiterPredicate, StringBuilder dst)
buf
- buffer with the sequence of chars to be parsedcursor
- defines the bounds and current position of the bufferdelimiterPredicate
- delimiter predicate. Can be null
if the token
is delimited by a whitespace or a quote only.dst
- destination buffer@Deprecated public void copyUnquotedContent(CharSequence buf, Tokenizer.Cursor cursor, BitSet bitSet, StringBuilder dst)
public void copyQuotedContent(CharSequence buf, Tokenizer.Cursor cursor, StringBuilder dst)
buf
- buffer with the sequence of chars to be parsedcursor
- defines the bounds and current position of the bufferdst
- destination bufferCopyright © 2005–2021 The Apache Software Foundation. All rights reserved.