CharSequenceTokenizerpublic class CharSequenceTokenizer extends AbstractTokenizer This trivial subclass of AbstractTokenizer is suitable for tokenizing input
stored in a String, StringBuffer, CharBuffer, or any other class that
implements CharSequence. Because CharSequence instances may be mutable,
the construtor makes an internal copy of the character sequence. This means
that any subsequent changes to the character sequence will not be seen
during tokenizing. |
Fields Summary |
---|
char[] | buffer |
Constructors Summary |
---|
public CharSequenceTokenizer(CharSequence sequence)Construct a new CharSequenceTokenizer to tokenize sequence.
This constructor makes an internal copy of the characters in the
specified sequence.
buffer = sequence.toString().toCharArray();
|
Methods Summary |
---|
protected void | createBuffer(int bufferSize)Set the inherited {@link #text} and {@link #numChars} fields.
This class knows the complete length of the input text, so it ignores
the bufferSize argument uses teh complete input sequence.
assert text == null; // verify that we're only called once
text = buffer;
numChars = buffer.length;
| protected boolean | fillBuffer()Return false to indicate no more input is available.
{@link #createBuffer} fills the buffer with the complete input sequence,
so this method returns false to indicate that no more text is available. return false;
|
|