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(); } }
@Override public void write(final int singleByte) throws IOException { checkNotClosed(); if (_position >= _outputBuffer.length) { writeCompressedBlock(); } _outputBuffer[_position++] = (byte) singleByte; }
@Override public void write(final int singleByte) throws IOException { checkNotClosed(); if (_position >= _outputBuffer.length) { writeCompressedBlock(); } _outputBuffer[_position++] = (byte) singleByte; }
@Override public void write(final int singleByte) throws IOException { checkNotClosed(); if (_position >= _outputBuffer.length) { writeCompressedBlock(); } _outputBuffer[_position++] = (byte) singleByte; }
/** * Method that can be used to force completion of the current block, * which means that all buffered data will be compressed into an * LZF block. This typically results in lower compression ratio * as larger blocks compress better; but may be necessary for * network connections to ensure timely sending of data. */ public LZFOutputStream finishBlock() throws IOException { checkNotClosed(); if (_position > 0) { writeCompressedBlock(); } return this; }
/** * Method that can be used to force completion of the current block, * which means that all buffered data will be compressed into an * LZF block. This typically results in lower compression ratio * as larger blocks compress better; but may be necessary for * network connections to ensure timely sending of data. */ public LZFOutputStream finishBlock() throws IOException { checkNotClosed(); if (_position > 0) { writeCompressedBlock(); } return this; }
/** * Method that can be used to force completion of the current block, * which means that all buffered data will be compressed into an * LZF block. This typically results in lower compression ratio * as larger blocks compress better; but may be necessary for * network connections to ensure timely sending of data. */ public LZFOutputStream finishBlock() throws IOException { checkNotClosed(); if (_position > 0) { writeCompressedBlock(); } return this; }
@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; }
@Override public void flush() throws IOException { checkNotClosed(); if (_cfgFinishBlockOnFlush && _position > 0) { writeCompressedBlock(); } super.flush(); }
@Override public void flush() throws IOException { checkNotClosed(); if (_cfgFinishBlockOnFlush && _position > 0) { writeCompressedBlock(); } super.flush(); }
@Override public void flush() throws IOException { checkNotClosed(); if (_cfgFinishBlockOnFlush && _position > 0) { writeCompressedBlock(); } super.flush(); }
@Override public void close() throws IOException { if (!_outputStreamClosed) { if (_position > 0) { writeCompressedBlock(); } super.close(); // will flush beforehand _encoder.close(); _outputStreamClosed = true; byte[] buf = _outputBuffer; if (buf != null) { _outputBuffer = null; _recycler.releaseOutputBuffer(buf); } } }
@Override public void close() throws IOException { if (!_outputStreamClosed) { if (_position > 0) { writeCompressedBlock(); } super.close(); // will flush beforehand _encoder.close(); _outputStreamClosed = true; byte[] buf = _outputBuffer; if (buf != null) { _outputBuffer = null; _recycler.releaseOutputBuffer(buf); } } }
@Override public void close() throws IOException { if (!_outputStreamClosed) { if (_position > 0) { writeCompressedBlock(); } super.close(); // will flush beforehand _encoder.close(); _outputStreamClosed = true; byte[] buf = _outputBuffer; if (buf != null) { _outputBuffer = null; _recycler.releaseOutputBuffer(buf); } } }
length -= free; _position += free; writeCompressedBlock();
length -= free; _position += free; writeCompressedBlock();