/** * This <code>flush</code> method does nothing. */ @Override public void flush() throws IOException { checkNotClosed(); }
/** * {@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; }
public PLZFOutputStream(final OutputStream outputStream) { this(outputStream, DEFAULT_OUTPUT_BUFFER_SIZE, getNThreads()); }
/** * Compress and write the current block to the OutputStream */ protected void writeCompressedBlock() throws IOException { if (_position == 0) { return; } Future<LZFChunk> lzfFuture = compressExecutor.submit(new CompressTask(_outputBuffer, 0, _position, blockManager)); writeExecutor.execute(new WriteTask(out, lzfFuture, this)); _outputBuffer = blockManager.getBlockFromPool(); _position = 0; checkWriteException(); }
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 FileChannel in) throws IOException { MappedByteBuffer src = in.map(MapMode.READ_ONLY, 0, in.size()); write(src); }
/** {@inheritDoc} */ @Override public LZFChunk call() { if (data != null) { LZFChunk lzfChunk = ENCODER.get().encodeChunk(data, offset, length); // input data is fully processed, we can now discard it blockManager.releaseBlockToPool(data); return lzfChunk; } else { // cleanup time! ENCODER.remove(); return null; } }
/** * Compress and write the current block to the OutputStream */ protected void writeCompressedBlock() throws IOException { if (_position == 0) { return; } Future<LZFChunk> lzfFuture = compressExecutor.submit(new CompressTask(_outputBuffer, 0, _position, blockManager)); writeExecutor.execute(new WriteTask(out, lzfFuture, this)); _outputBuffer = blockManager.getBlockFromPool(); _position = 0; checkWriteException(); }
/** * {@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; }
/** * This <code>flush</code> method does nothing. */ @Override public void flush() throws IOException { checkNotClosed(); }
public PLZFOutputStream(final OutputStream outputStream) { this(outputStream, DEFAULT_OUTPUT_BUFFER_SIZE, getNThreads()); }
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 FileChannel in) throws IOException { MappedByteBuffer src = in.map(MapMode.READ_ONLY, 0, in.size()); write(src); }
/** {@inheritDoc} */ @Override public LZFChunk call() { if (data != null) { LZFChunk lzfChunk = ENCODER.get().encodeChunk(data, offset, length); // input data is fully processed, we can now discard it blockManager.releaseBlockToPool(data); return lzfChunk; } else { // cleanup time! ENCODER.remove(); return null; } }
/** * Compress and write the current block to the OutputStream */ protected void writeCompressedBlock() throws IOException { if (_position == 0) { return; } Future<LZFChunk> lzfFuture = compressExecutor.submit(new CompressTask(_outputBuffer, 0, _position, blockManager)); writeExecutor.execute(new WriteTask(out, lzfFuture, this)); _outputBuffer = blockManager.getBlockFromPool(); _position = 0; checkWriteException(); }
/** * {@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; }
/** * This <code>flush</code> method does nothing. */ @Override public void flush() throws IOException { checkNotClosed(); }
public PLZFOutputStream(final OutputStream outputStream) { this(outputStream, DEFAULT_OUTPUT_BUFFER_SIZE, getNThreads()); }
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 FileChannel in) throws IOException { MappedByteBuffer src = in.map(MapMode.READ_ONLY, 0, in.size()); write(src); }