DataBlock nextRawBlock(DataBlock reuse) throws IOException { if (!hasNextBlock()) { throw new NoSuchElementException(); } if (reuse == null || reuse.data.length < (int) blockSize) { reuse = new DataBlock(blockRemaining, (int) blockSize); } else { reuse.numEntries = blockRemaining; reuse.blockSize = (int)blockSize; } // throws if it can't read the size requested vin.readFixed(reuse.data, 0, reuse.blockSize); vin.readFixed(syncBuffer); availableBlock = false; if (!Arrays.equals(syncBuffer, header.sync)) throw new IOException("Invalid sync!"); return reuse; }
DataBlock nextRawBlock(DataBlock reuse) throws IOException { if (!hasNextBlock()) { throw new NoSuchElementException(); } if (reuse == null || reuse.data.length < (int) blockSize) { reuse = new DataBlock(blockRemaining, (int) blockSize); } else { reuse.numEntries = blockRemaining; reuse.blockSize = (int)blockSize; } // throws if it can't read the size requested vin.readFixed(reuse.data, 0, reuse.blockSize); vin.readFixed(syncBuffer); availableBlock = false; if (!Arrays.equals(syncBuffer, header.sync)) throw new IOException("Invalid sync!"); return reuse; }
/** True if more entries remain in this file. */ @Override public boolean hasNext() { try { if (blockRemaining == 0) { // check that the previous block was finished if (null != datumIn) { boolean atEnd = datumIn.isEnd(); if (!atEnd) { throw new IOException("Block read partially, the data may be corrupt"); } } if (hasNextBlock()) { block = nextRawBlock(block); block.decompressUsing(codec); blockBuffer = block.getAsByteBuffer(); datumIn = DecoderFactory.get().binaryDecoder( blockBuffer.array(), blockBuffer.arrayOffset() + blockBuffer.position(), blockBuffer.remaining(), datumIn); } } return blockRemaining != 0; } catch (EOFException e) { // at EOF return false; } catch (IOException e) { throw new AvroRuntimeException(e); } }
/** True if more entries remain in this file. */ @Override public boolean hasNext() { try { if (blockRemaining == 0) { // check that the previous block was finished if (null != datumIn) { boolean atEnd = datumIn.isEnd(); if (!atEnd) { throw new IOException("Block read partially, the data may be corrupt"); } } if (hasNextBlock()) { block = nextRawBlock(block); block.decompressUsing(codec); blockBuffer = block.getAsByteBuffer(); datumIn = DecoderFactory.get().binaryDecoder( blockBuffer.array(), blockBuffer.arrayOffset() + blockBuffer.position(), blockBuffer.remaining(), datumIn); } } return blockRemaining != 0; } catch (EOFException e) { // at EOF return false; } catch (IOException e) { throw new AvroRuntimeException(e); } }
if (codec.equals(otherCodec) && !recompress) { while(otherFile.hasNextBlock()) { nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw); nextBlockRaw.writeBlockTo(vout, sync); while(otherFile.hasNextBlock()) { nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw); nextBlockRaw.decompressUsing(otherCodec);
if (codec.equals(otherCodec) && !recompress) { while(otherFile.hasNextBlock()) { nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw); nextBlockRaw.writeBlockTo(vout, sync); while(otherFile.hasNextBlock()) { nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw); nextBlockRaw.decompressUsing(otherCodec);
DataBlock nextRawBlock(DataBlock reuse) throws IOException { if (!hasNextBlock()) { throw new NoSuchElementException(); } if (reuse == null || reuse.data.length < (int) blockSize) { reuse = new DataBlock(blockRemaining, (int) blockSize); } else { reuse.numEntries = blockRemaining; reuse.blockSize = (int)blockSize; } // throws if it can't read the size requested vin.readFixed(reuse.data, 0, reuse.blockSize); vin.readFixed(syncBuffer); if (!Arrays.equals(syncBuffer, header.sync)) throw new IOException("Invalid sync!"); availableBlock = false; return reuse; }
DataBlock nextRawBlock(DataBlock reuse) throws IOException { if (!hasNextBlock()) { throw new NoSuchElementException(); } if (reuse == null || reuse.data.length < (int) blockSize) { reuse = new DataBlock(blockRemaining, (int) blockSize); } else { reuse.numEntries = blockRemaining; reuse.blockSize = (int)blockSize; } // throws if it can't read the size requested vin.readFixed(reuse.data, 0, reuse.blockSize); vin.readFixed(syncBuffer); if (!Arrays.equals(syncBuffer, sync)) throw new IOException("Invalid sync!"); availableBlock = false; return reuse; }
DataBlock nextRawBlock(DataBlock reuse) throws IOException { if (!hasNextBlock()) { throw new NoSuchElementException(); } if (reuse == null || reuse.data.length < (int) blockSize) { reuse = new DataBlock(blockRemaining, (int) blockSize); } else { reuse.numEntries = blockRemaining; reuse.blockSize = (int)blockSize; } // throws if it can't read the size requested vin.readFixed(reuse.data, 0, reuse.blockSize); vin.readFixed(syncBuffer); availableBlock = false; if (!Arrays.equals(syncBuffer, header.sync)) throw new IOException("Invalid sync!"); return reuse; }
DataBlock nextBlock(DataBlock reuse) throws IOException { if (!hasNextBlock()) { throw new NoSuchElementException(); } if (reuse == null || reuse.data.length < (int) blockSize) { reuse = new DataBlock(blockRemaining, (int) blockSize); } else { reuse.numEntries = blockRemaining; reuse.blockSize = (int)blockSize; } // throws if it can't read the size requested vin.readFixed(reuse.data, 0, reuse.blockSize); skipSync(); availableBlock = false; return reuse; }
/** True if more entries remain in this file. */ @Override public boolean hasNext() { try { if (blockRemaining == 0) { // check that the previous block was finished if (null != datumIn) { boolean atEnd = datumIn.isEnd(); if (!atEnd) { throw new IOException("Block read partially, the data may be corrupt"); } } if (hasNextBlock()) { block = nextRawBlock(block); block.decompressUsing(codec); blockBuffer = block.getAsByteBuffer(); datumIn = DecoderFactory.get().binaryDecoder( blockBuffer.array(), blockBuffer.arrayOffset() + blockBuffer.position(), blockBuffer.remaining(), datumIn); } } return blockRemaining != 0; } catch (EOFException e) { // at EOF return false; } catch (IOException e) { throw new AvroRuntimeException(e); } }
/** True if more entries remain in this file. */ public boolean hasNext() { try { if (blockRemaining == 0) { // check that the previous block was finished if (null != datumIn) { boolean atEnd = datumIn.isEnd(); if (!atEnd) { throw new IOException("Block read partially, the data may be corrupt"); } } if (hasNextBlock()) { block = nextBlock(block); ByteBuffer blockBuffer = ByteBuffer.wrap(block.data, 0, block.blockSize); blockBuffer = codec.decompress(blockBuffer); datumIn = DecoderFactory.defaultFactory().createBinaryDecoder( blockBuffer.array(), blockBuffer.arrayOffset() + blockBuffer.position(), blockBuffer.remaining(), datumIn); } } return blockRemaining != 0; } catch (EOFException e) { // at EOF return false; } catch (IOException e) { throw new AvroRuntimeException(e); } }
/** True if more entries remain in this file. */ @Override public boolean hasNext() { try { if (blockRemaining == 0) { // check that the previous block was finished if (null != datumIn) { boolean atEnd = datumIn.isEnd(); if (!atEnd) { throw new IOException("Block read partially, the data may be corrupt"); } } if (hasNextBlock()) { block = nextRawBlock(block); block.decompressUsing(codec); blockBuffer = block.getAsByteBuffer(); datumIn = DecoderFactory.get().binaryDecoder( blockBuffer.array(), blockBuffer.arrayOffset() + blockBuffer.position(), blockBuffer.remaining(), datumIn); } } return blockRemaining != 0; } catch (EOFException e) { // at EOF return false; } catch (IOException e) { throw new AvroRuntimeException(e); } }
/** True if more entries remain in this file. */ public boolean hasNext() { try { if (blockRemaining == 0) { // check that the previous block was finished if (null != datumIn) { boolean atEnd = datumIn.isEnd(); if (!atEnd) { throw new IOException("Block read partially, the data may be corrupt"); } } if (hasNextBlock()) { block = nextRawBlock(block); block.decompressUsing(codec); blockBuffer = block.getAsByteBuffer(); datumIn = DecoderFactory.defaultFactory().createBinaryDecoder( blockBuffer.array(), blockBuffer.arrayOffset() + blockBuffer.position(), blockBuffer.remaining(), datumIn); } } return blockRemaining != 0; } catch (EOFException e) { // at EOF return false; } catch (IOException e) { throw new AvroRuntimeException(e); } }
if (codec.equals(otherCodec) && !recompress) { while(otherFile.hasNextBlock()) { nextBlockRaw = otherFile.nextBlock(nextBlockRaw); writeRawBlock(nextBlockRaw); while(otherFile.hasNextBlock()) { nextBlockRaw = otherFile.nextBlock(nextBlockRaw); ByteBuffer uncompressedData = otherCodec.decompress(ByteBuffer.wrap(
if (codec.equals(otherCodec) && !recompress) { while(otherFile.hasNextBlock()) { nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw); nextBlockRaw.writeBlockTo(vout, sync); while(otherFile.hasNextBlock()) { nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw); nextBlockRaw.decompressUsing(otherCodec);
if (codec.equals(otherCodec) && !recompress) { while(otherFile.hasNextBlock()) { nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw); nextBlockRaw.writeBlockTo(vout, sync); while(otherFile.hasNextBlock()) { nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw); nextBlockRaw.decompressUsing(otherCodec);
if (codec.equals(otherCodec) && !recompress) { while(otherFile.hasNextBlock()) { nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw); nextBlockRaw.writeBlockTo(vout, sync); while(otherFile.hasNextBlock()) { nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw); nextBlockRaw.decompressUsing(otherCodec);