if (encoding != null) {
CharsetDecoder decoder = getDecoder(encoding);
// Create buffer for characters decoding
CharBuffer charBuffer = CharBuffer.allocate(buffer.length);
// Create buffer for bytes
float bytesPerChar = decoder.charset().newEncoder().maxBytesPerChar();
ByteBuffer byteBuffer = ByteBuffer.allocate((int) (buffer.length + bytesPerChar));
if (buffers != null) {
for (byte[] bytes : buffers) {
decodeAndWriteOut(out, bytes, bytes.length, byteBuffer, charBuffer, decoder, false);
}