@Override public void writeBytes(byte[] source, int sourceIndex, int length) { // Write huge chunks direct to OutputStream if (length >= DIRECT_FLUSH_SIZE) { // todo fill buffer before flushing flushBufferToOutputStream(); writeDirectlyToOutputStream(source, sourceIndex, length); bufferOffset += length; } else { ensureWritableBytes(length); slice.setBytes(bufferPosition, source, sourceIndex, length); bufferPosition += length; } }
@Override public void writeBytes(Slice source, int sourceIndex, int length) { // Write huge chunks direct to OutputStream if (length >= DIRECT_FLUSH_SIZE) { flushBufferToOutputStream(); writeDirectlyToOutputStream((byte[]) source.getBase(), sourceIndex + (int) (source.getAddress() - ARRAY_BYTE_BASE_OFFSET), length); bufferOffset += length; } else { ensureWritableBytes(length); slice.setBytes(bufferPosition, source, sourceIndex, length); bufferPosition += length; } }
@Override public void writeBytes(byte[] source, int sourceIndex, int length) { // Write huge chunks direct to OutputStream if (length >= DIRECT_FLUSH_SIZE) { // todo fill buffer before flushing flushBufferToOutputStream(); writeDirectlyToOutputStream(source, sourceIndex, length); bufferOffset += length; } else { ensureWritableBytes(length); slice.setBytes(bufferPosition, source, sourceIndex, length); bufferPosition += length; } }
@Override public void writeBytes(Slice source, int sourceIndex, int length) { // Write huge chunks direct to OutputStream if (length >= DIRECT_FLUSH_SIZE) { flushBufferToOutputStream(); writeDirectlyToOutputStream((byte[]) source.getBase(), sourceIndex + (int) (source.getAddress() - ARRAY_BYTE_BASE_OFFSET), length); bufferOffset += length; } else { ensureWritableBytes(length); slice.setBytes(bufferPosition, source, sourceIndex, length); bufferPosition += length; } }