private void flushBuffer() throws IOException { out.write(FramedSnappyCompressorInputStream.COMPRESSED_CHUNK_TYPE); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (OutputStream o = new SnappyCompressorOutputStream(baos, currentIndex, params)) { o.write(buffer, 0, currentIndex); } byte[] b = baos.toByteArray(); writeLittleEndian(3, b.length + 4L /* CRC */); writeCrc(); out.write(b); currentIndex = 0; }
private void flushBuffer() throws IOException { out.write(FramedSnappyCompressorInputStream.COMPRESSED_CHUNK_TYPE); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try (OutputStream o = new SnappyCompressorOutputStream(baos, currentIndex, params)) { o.write(buffer, 0, currentIndex); } byte[] b = baos.toByteArray(); writeLittleEndian(3, b.length + 4L /* CRC */); writeCrc(); out.write(b); currentIndex = 0; }
@Override public CompressorOutputStream getCompressorStream(OutputStream stream) throws IOException { if (isFramed() || getSrc() == null || getSrc().getSize() < 0) { return super.getCompressorStream(stream); } return new SnappyCompressorOutputStream(stream, getSrc().getSize()); } }