private void readUtf8(int charCount) { byte[] buffer = this.buffer; char[] chars = this.chars; // Try to read 7 bit ASCII chars. int charIndex = 0; int count = Math.min(require(1), charCount); int position = this.position; int b; while (charIndex < count) { b = buffer[position++]; if (b < 0) { position--; break; } chars[charIndex++] = (char) b; } this.position = position; // If buffer didn't hold all chars or any were not ASCII, use slow path for remainder. if (charIndex < charCount) readUtf8_slow(charCount, charIndex); }