public void write(final InputStream in) throws IOException { writeCompressedBlock(); // will flush _outputBuffer int read; while ((read = in.read(_outputBuffer)) >= 0) { _position = read; writeCompressedBlock(); } }
public void write(final InputStream in) throws IOException { writeCompressedBlock(); // will flush _outputBuffer int read; while ((read = in.read(_outputBuffer)) >= 0) { _position = read; writeCompressedBlock(); } }
public void write(final InputStream in) throws IOException { writeCompressedBlock(); // will flush _outputBuffer int read; while ((read = in.read(_outputBuffer)) >= 0) { _position = read; writeCompressedBlock(); } }
/** * {@inheritDoc} * WARNING: using this method will lead to very poor performance! */ @Override public void write(final int singleByte) throws IOException { checkNotClosed(); if (_position >= _outputBuffer.length) { writeCompressedBlock(); } _outputBuffer[_position++] = (byte) singleByte; }
/** * {@inheritDoc} * WARNING: using this method will lead to very poor performance! */ @Override public void write(final int singleByte) throws IOException { checkNotClosed(); if (_position >= _outputBuffer.length) { writeCompressedBlock(); } _outputBuffer[_position++] = (byte) singleByte; }
/** * {@inheritDoc} * WARNING: using this method will lead to very poor performance! */ @Override public void write(final int singleByte) throws IOException { checkNotClosed(); if (_position >= _outputBuffer.length) { writeCompressedBlock(); } _outputBuffer[_position++] = (byte) singleByte; }
@Override public synchronized int write(final ByteBuffer src) throws IOException { int r = src.remaining(); if (r <= 0) { return r; } writeCompressedBlock(); // will flush _outputBuffer if (src.hasArray()) { // direct compression from backing array write(src.array(), src.arrayOffset(), src.limit() - src.arrayOffset()); } else { // need to copy to heap array first while (src.hasRemaining()) { int toRead = Math.min(src.remaining(), _outputBuffer.length); src.get(_outputBuffer, 0, toRead); _position = toRead; writeCompressedBlock(); } } return r; }
@Override public synchronized int write(final ByteBuffer src) throws IOException { int r = src.remaining(); if (r <= 0) { return r; } writeCompressedBlock(); // will flush _outputBuffer if (src.hasArray()) { // direct compression from backing array write(src.array(), src.arrayOffset(), src.limit() - src.arrayOffset()); } else { // need to copy to heap array first while (src.hasRemaining()) { int toRead = Math.min(src.remaining(), _outputBuffer.length); src.get(_outputBuffer, 0, toRead); _position = toRead; writeCompressedBlock(); } } return r; }
@Override public synchronized int write(final ByteBuffer src) throws IOException { int r = src.remaining(); if (r <= 0) { return r; } writeCompressedBlock(); // will flush _outputBuffer if (src.hasArray()) { // direct compression from backing array write(src.array(), src.arrayOffset(), src.limit() - src.arrayOffset()); } else { // need to copy to heap array first while (src.hasRemaining()) { int toRead = Math.min(src.remaining(), _outputBuffer.length); src.get(_outputBuffer, 0, toRead); _position = toRead; writeCompressedBlock(); } } return r; }
length -= free; _position += free; writeCompressedBlock(); System.arraycopy(buffer, offset, _outputBuffer, 0, BUFFER_LEN); _position = BUFFER_LEN; writeCompressedBlock(); offset += BUFFER_LEN; length -= BUFFER_LEN;
length -= free; _position += free; writeCompressedBlock(); System.arraycopy(buffer, offset, _outputBuffer, 0, BUFFER_LEN); _position = BUFFER_LEN; writeCompressedBlock(); offset += BUFFER_LEN; length -= BUFFER_LEN;
length -= free; _position += free; writeCompressedBlock(); System.arraycopy(buffer, offset, _outputBuffer, 0, BUFFER_LEN); _position = BUFFER_LEN; writeCompressedBlock(); offset += BUFFER_LEN; length -= BUFFER_LEN;