/** * Helper method called when the whole character sequence is known to fit in * the output buffer regardless of UTF-8 expansion. */ private final int _encode(int outputPtr, char[] str, int i, int end) { // First: let's see if it's all ASCII: that's rather fast final byte[] outBuf = _outputBuffer; final int outputStart = outputPtr; do { int c = str[i]; if (c > 0x7F) { return _shortUTF8Encode2(str, i, end, outputPtr, outputStart); } outBuf[outputPtr++] = (byte) c; } while (++i < end); return outputPtr - outputStart; }
/** * Helper method called when the whole character sequence is known to * fit in the output buffer regardless of UTF-8 expansion. */ private final int _encode(int outputPtr, char[] str, int i, int end) { // First: let's see if it's all ASCII: that's rather fast final byte[] outBuf = _outputBuffer; final int outputStart = outputPtr; do { int c = str[i]; if (c > 0x7F) { return _shortUTF8Encode2(str, i, end, outputPtr, outputStart); } outBuf[outputPtr++] = (byte) c; } while (++i < end); return outputPtr - outputStart; }
/** * Helper method called when the whole character sequence is known to * fit in the output buffer regardless of UTF-8 expansion. */ private final int _encode(int outputPtr, char[] str, int i, int end) { // First: let's see if it's all ASCII: that's rather fast final byte[] outBuf = _outputBuffer; final int outputStart = outputPtr; do { int c = str[i]; if (c > 0x7F) { return _shortUTF8Encode2(str, i, end, outputPtr, outputStart); } outBuf[outputPtr++] = (byte) c; } while (++i < end); return outputPtr - outputStart; }