// Make sure AbstractTokenizer is upholding its end of the bargain
assert text!=null && 0 <= tokenStart && tokenStart <= tokenEnd &&
tokenEnd <= p && p <= numChars && numChars <= text.length;
// First, shift already tokenized characters out of the buffer
if (tokenStart > 0) {
// Shift array contents
System.arraycopy(text, tokenStart, text, 0, numChars-tokenStart);
// And update buffer indexes
tokenEnd -= tokenStart;
p -= tokenStart;
numChars -= tokenStart;
tokenStart = 0;
}
// Now try to read more characters into the buffer
int numread = in.read(text, numChars, text.length-numChars);
// If there are no more characters, return false
if (numread == -1) return false;
// Otherwise, adjust the number of valid characters in the buffer
numChars += numread;
return true;