swallowBom = false;
}
private void runStates() throws SAXException, IOException {
char[] buffer = new char[2048];
UTF16Buffer bufr = new UTF16Buffer(buffer, 0, 0);
boolean lastWasCR = false;
int len = -1;
if ((len = reader.read(buffer)) != -1) {
assert len > 0;
int streamOffset = 0;
int offset = 0;
int length = len;
if (swallowBom) {
if (buffer[0] == '\uFEFF') {
streamOffset = -1;
offset = 1;
length--;
}
}
if (length > 0) {
for (int i = 0; i < characterHandlers.length; i++) {
CharacterHandler ch = characterHandlers[i];
ch.characters(buffer, offset, length);
}
tokenizer.setTransitionBaseOffset(streamOffset);
bufr.setStart(offset);
bufr.setEnd(offset + length);
while (bufr.hasMore()) {
bufr.adjust(lastWasCR);
lastWasCR = false;
if (bufr.hasMore()) {
lastWasCR = tokenizer.tokenizeBuffer(bufr);
}
}
}
streamOffset = length;
while ((len = reader.read(buffer)) != -1) {
assert len > 0;
for (int i = 0; i < characterHandlers.length; i++) {
CharacterHandler ch = characterHandlers[i];
ch.characters(buffer, 0, len);
}
tokenizer.setTransitionBaseOffset(streamOffset);
bufr.setStart(0);
bufr.setEnd(len);
while (bufr.hasMore()) {
bufr.adjust(lastWasCR);
lastWasCR = false;
if (bufr.hasMore()) {
lastWasCR = tokenizer.tokenizeBuffer(bufr);
}
}
streamOffset += len;
}