/** * * @param descriptor descriptor for the chunk * @param buffers ByteBuffers that contain the chunk */ public Chunk(ChunkDescriptor descriptor, List<ByteBuffer> buffers) { this.descriptor = descriptor; this.stream = ByteBufferInputStream.wrap(buffers); }
/** * @param descriptor descriptor for the chunk * @param buffers ByteBuffers that contain the chunk * @param offsetIndex the offset index for this column; might be null */ public Chunk(ChunkDescriptor descriptor, List<ByteBuffer> buffers, OffsetIndex offsetIndex) { this.descriptor = descriptor; this.stream = ByteBufferInputStream.wrap(buffers); this.offsetIndex = offsetIndex; }
@Override public ByteBufferInputStream toInputStream() { return ByteBufferInputStream.wrap(buffers); }
@Override public ByteBufferInputStream toInputStream() { return ByteBufferInputStream.wrap(buffer); }
@Override public ByteBufferInputStream toInputStream() { return ByteBufferInputStream.wrap(buffer); }
@Override public ByteBufferInputStream toInputStream() { return ByteBufferInputStream.wrap(buffers); }
/** * @param buffer * the buffer to be wrapped in this input stream * @deprecated Will be removed in 2.0.0; Use {@link #wrap(ByteBuffer...)} instead */ @Deprecated public ByteBufferInputStream(ByteBuffer buffer) { delegate = wrap(buffer); }
/** * @param buffer * the buffer to be wrapped in this input stream * @param offset * the offset of the data in the buffer * @param count * the number of bytes to be read from the buffer * @deprecated Will be removed in 2.0.0; Use {@link #wrap(ByteBuffer...)} instead */ @Deprecated public ByteBufferInputStream(ByteBuffer buffer, int offset, int count) { ByteBuffer temp = buffer.duplicate(); temp.position(offset); ByteBuffer byteBuf = temp.slice(); byteBuf.limit(count); delegate = wrap(byteBuf); }
/** * * @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()); }
public ByteBufferInputStream remainingStream() { return ByteBufferInputStream.wrap(remainingBuffers()); } }
/** * * @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()); }
public ByteBufferInputStream sliceStream(long length) throws EOFException { return ByteBufferInputStream.wrap(sliceBuffers(length)); }
public ByteBufferInputStream sliceStream(long length) throws EOFException { return ByteBufferInputStream.wrap(sliceBuffers(length)); }
public ByteBufferInputStream remainingStream() { return ByteBufferInputStream.wrap(remainingBuffers()); }
ByteBuffer pageWithOffset = page.duplicate(); pageWithOffset.position(offset); initFromPage(valueCount, ByteBufferInputStream.wrap(pageWithOffset)); actualOffset = -1;
private ColumnChunkPageReader readChunk(SeekableInputStream f, ChunkDescriptor descriptor) { try { List<ByteBuffer> buffers = readBlocks(f, descriptor.fileOffset, descriptor.size); ByteBufferInputStream stream = ByteBufferInputStream.wrap(buffers); Chunk chunk = new WorkaroundChunk(descriptor, stream.sliceBuffers(descriptor.size), f, null); return chunk.readAllPages(); } catch (IOException e) { throw new RuntimeException(e); } }
/** * @param f file to read the chunks from * @param builder used to build chunk list to read the pages for the different columns * @throws IOException if there is an error while reading from the stream */ public void readAll(SeekableInputStream f, ChunkListBuilder builder) throws IOException { List<ByteBuffer> buffers = readBlocks(f, offset, length); // report in a counter the data we just scanned BenchmarkCounter.incrementBytesRead(length); ByteBufferInputStream stream = ByteBufferInputStream.wrap(buffers); for (int i = 0; i < chunks.size(); i++) { ChunkDescriptor descriptor = chunks.get(i); builder.add(descriptor, stream.sliceBuffers(descriptor.size), f); } }
ByteBufferInputStream stream = ByteBufferInputStream.wrap(buffers); for (int i = 0; i < chunks.size(); i++) { ChunkDescriptor descriptor = chunks.get(i);
final ByteBufferInputStream in = ByteBufferInputStream.wrap(pageData.nioBuffer(0, pageData.capacity())); ByteBuffer byteBuffer = pageData.nioBuffer(index, pageData.capacity() - index); dictionaryLengthDeterminingReader = new DictionaryValuesReader(dictionary); dictionaryLengthDeterminingReader.initFromPage(currentPageCount, ByteBufferInputStream.wrap(byteBuffer)); dictionaryValueReader = new DictionaryValuesReader(dictionary); dictionaryValueReader.initFromPage(currentPageCount, ByteBufferInputStream.wrap(byteBuffer)); parentColumnReader.usingDictionary = true; } else {
final Encoding dlEncoding = METADATA_CONVERTER.getEncoding(pageHeader.data_page_header.definition_level_encoding); final ByteBufferInputStream in = ByteBufferInputStream.wrap(pageData.nioBuffer(0, pageData.capacity()));