/** * All other Writer methods vector through this, so this is the only one that must be overridden. */ @Override public void write(final char[] chars, int offset, int length) throws IOException { while (length > 0) { final int charsToConvert = Math.min(length, buffer.length - numBytes); StringUtil.charsToBytes(chars, offset, charsToConvert, buffer, numBytes); numBytes += charsToConvert; offset += charsToConvert; length -= charsToConvert; if (numBytes == buffer.length) { os.write(buffer, 0, numBytes); numBytes = 0; } } } }
/** * All other Writer methods vector through this, so this is the only one that must be overridden. */ public void write(final char[] chars, int offset, int length) throws IOException { while (length > 0) { final int charsToConvert = Math.min(length, buffer.length - numBytes); StringUtil.charsToBytes(chars, offset, charsToConvert, buffer, numBytes); numBytes += charsToConvert; offset += charsToConvert; length -= charsToConvert; if (numBytes == buffer.length) { os.write(buffer, 0, numBytes); numBytes = 0; } } } }
/** * All other Writer methods vector through this, so this is the only one that must be overridden. */ @Override public void write(final char[] chars, int offset, int length) throws IOException { while (length > 0) { final int charsToConvert = Math.min(length, buffer.length - numBytes); StringUtil.charsToBytes(chars, offset, charsToConvert, buffer, numBytes); numBytes += charsToConvert; offset += charsToConvert; length -= charsToConvert; if (numBytes == buffer.length) { os.write(buffer, 0, numBytes); numBytes = 0; } } } }