final int searchEnd=coalescing ? streamedText.getEnd() : streamedText.getBufferOverflowPosition(); while (i<searchEnd) { final char ch=streamedText.charAt(i); if (ch==StreamedText.END_OF_STREAM && streamedText.atEndOfStream()) break; // checking ch==StreamedText.END_OF_STREAM first is superfluous but is probably faster than calling atEndOfStream() in the normal case. if (ch=='&') {