/** * * @return a new InputStream materializing the contents of this input * @throws IOException if there is an exception reading */ public ByteBufferInputStream toInputStream() throws IOException { return ByteBufferInputStream.wrap(toByteBuffer()); }
/** * * @return a new InputStream materializing the contents of this input * @throws IOException if there is an exception reading */ public ByteBufferInputStream toInputStream() throws IOException { return ByteBufferInputStream.wrap(toByteBuffer()); }
@Override public void decompress(ByteBuffer input, int compressedSize, ByteBuffer output, int uncompressedSize) throws IOException { ByteBuffer decompressed = decompress(BytesInput.from(input), uncompressedSize).toByteBuffer(); output.put(decompressed); }
@Override public void decompress(ByteBuffer input, int compressedSize, ByteBuffer output, int uncompressedSize) throws IOException { ByteBuffer decompressed = decompress(BytesInput.from(input), uncompressedSize).toByteBuffer(); output.put(decompressed); }
/** * Compress a given buffer of bytes * @param bytes * @return * @throws IOException */ @Override public BytesInput compress(BytesInput bytes) throws IOException { int maxOutputSize = Snappy.maxCompressedLength((int) bytes.size()); ByteBuffer bufferIn = bytes.toByteBuffer(); outgoing = ensure(outgoing, maxOutputSize); final int size; if (bufferIn.isDirect()) { size = Snappy.compress(bufferIn, outgoing); } else { // Snappy library requires buffers be direct this.incoming = ensure(this.incoming, (int) bytes.size()); this.incoming.put(bufferIn); this.incoming.flip(); size = Snappy.compress(this.incoming, outgoing); } outgoing.limit(size); return BytesInput.from(outgoing); }
/** * Compress a given buffer of bytes * @param bytes * @return * @throws IOException */ @Override public BytesInput compress(BytesInput bytes) throws IOException { int maxOutputSize = Snappy.maxCompressedLength((int) bytes.size()); ByteBuffer bufferIn = bytes.toByteBuffer(); outgoing = ensure(outgoing, maxOutputSize); final int size; if (bufferIn.isDirect()) { size = Snappy.compress(bufferIn, outgoing); } else { // Snappy library requires buffers be direct this.incoming = ensure(this.incoming, (int) bytes.size()); this.incoming.put(bufferIn); this.incoming.flip(); size = Snappy.compress(this.incoming, outgoing); } outgoing.limit(size); return BytesInput.from(outgoing); }
final ByteBuffer dictionaryBytes = dictionaryPage.getBytes().toByteBuffer(); binaryDictionaryContent = new Binary[dictionaryPage.getDictionarySize()];
final ByteBuffer dictionaryBytes = dictionaryPage.getBytes().toByteBuffer(); binaryDictionaryContent = new Binary[dictionaryPage.getDictionarySize()];
BytesInput.from(buffer), pageHeader.uncompressed_page_size); ByteBuffer byteBuffer = decompressedPageData.toByteBuffer(); int limit = byteBuffer.limit(); byteBuffer.limit(dataHeaderV2.getRepetition_levels_byte_length());