Package org.apache.avro.file.DataFileStream

Examples of org.apache.avro.file.DataFileStream.DataBlock


      throw new IOException("Schema from file " + otherFile + " does not match");
    }
    // flush anything written so far
    writeBlock();
    Codec otherCodec = otherFile.resolveCodec();
    DataBlock nextBlockRaw = null;
    if (codec.equals(otherCodec) && !recompress) {
      // copy raw bytes
      while(otherFile.hasNextBlock()) {
        nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw);
        nextBlockRaw.writeBlockTo(vout, sync);
      }
    } else {
      while(otherFile.hasNextBlock()) {
        nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw);
        nextBlockRaw.decompressUsing(otherCodec);
        nextBlockRaw.compressUsing(codec);
        nextBlockRaw.writeBlockTo(vout, sync);
      }
    }
  }
View Full Code Here


 
  private void writeBlock() throws IOException {
    if (blockCount > 0) {
      bufOut.flush();
      ByteBuffer uncompressed = buffer.getByteArrayAsByteBuffer();
      DataBlock block = new DataBlock(uncompressed, blockCount);
      block.compressUsing(codec);
      block.writeBlockTo(vout, sync);
      buffer.reset();
      blockCount = 0;
    }
  }
View Full Code Here

      throw new IOException("Schema from file " + otherFile + " does not match");
    }
    // flush anything written so far
    writeBlock();
    Codec otherCodec = otherFile.resolveCodec();
    DataBlock nextBlockRaw = null;
    if (codec.equals(otherCodec) && !recompress) {
      // copy raw bytes
      while(otherFile.hasNextBlock()) {
        nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw);
        nextBlockRaw.writeBlockTo(vout, sync);
      }
    } else {
      while(otherFile.hasNextBlock()) {
        nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw);
        nextBlockRaw.decompressUsing(otherCodec);
        nextBlockRaw.compressUsing(codec);
        nextBlockRaw.writeBlockTo(vout, sync);
      }
    }
  }
View Full Code Here

 
  private void writeBlock() throws IOException {
    if (blockCount > 0) {
      bufOut.flush();
      ByteBuffer uncompressed = buffer.getByteArrayAsByteBuffer();
      DataBlock block = new DataBlock(uncompressed, blockCount);
      block.setFlushOnWrite(flushOnEveryBlock);
      block.compressUsing(codec);
      block.writeBlockTo(vout, sync);
      buffer.reset();
      blockCount = 0;
    }
  }
View Full Code Here

      throw new IOException("Schema from file " + otherFile + " does not match");
    }
    // flush anything written so far
    writeBlock();
    Codec otherCodec = otherFile.resolveCodec();
    DataBlock nextBlockRaw = null;
    if (codec.equals(otherCodec) && !recompress) {
      // copy raw bytes
      while(otherFile.hasNextBlock()) {
        nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw);
        nextBlockRaw.writeBlockTo(vout, sync);
      }
    } else {
      while(otherFile.hasNextBlock()) {
        nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw);
        nextBlockRaw.decompressUsing(otherCodec);
        nextBlockRaw.compressUsing(codec);
        nextBlockRaw.writeBlockTo(vout, sync);
      }
    }
  }
View Full Code Here

 
  private void writeBlock() throws IOException {
    if (blockCount > 0) {
      bufOut.flush();
      ByteBuffer uncompressed = buffer.getByteArrayAsByteBuffer();
      DataBlock block = new DataBlock(uncompressed, blockCount);
      block.compressUsing(codec);
      block.writeBlockTo(vout, sync);
      buffer.reset();
      blockCount = 0;
    }
  }
View Full Code Here

      throw new IOException("Schema from file " + otherFile + " does not match");
    }
    // flush anything written so far
    writeBlock();
    Codec otherCodec = otherFile.resolveCodec();
    DataBlock nextBlockRaw = null;
    if (codec.equals(otherCodec) && !recompress) {
      // copy raw bytes
      while(otherFile.hasNextBlock()) {
        nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw);
        nextBlockRaw.writeBlockTo(vout, sync);
      }
    } else {
      while(otherFile.hasNextBlock()) {
        nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw);
        nextBlockRaw.decompressUsing(otherCodec);
        nextBlockRaw.compressUsing(codec);
        nextBlockRaw.writeBlockTo(vout, sync);
      }
    }
  }
View Full Code Here

 
  private void writeBlock() throws IOException {
    if (blockCount > 0) {
      bufOut.flush();
      ByteBuffer uncompressed = buffer.getByteArrayAsByteBuffer();
      DataBlock block = new DataBlock(uncompressed, blockCount);
      block.compressUsing(codec);
      block.writeBlockTo(vout, sync);
      buffer.reset();
      blockCount = 0;
    }
  }
View Full Code Here

      throw new IOException("Schema from file " + otherFile + " does not match");
    }
    // flush anything written so far
    writeBlock();
    Codec otherCodec = otherFile.resolveCodec();
    DataBlock nextBlockRaw = null;
    if (codec.equals(otherCodec) && !recompress) {
      // copy raw bytes
      while(otherFile.hasNextBlock()) {
        nextBlockRaw = otherFile.nextBlock(nextBlockRaw);
        writeRawBlock(nextBlockRaw);
View Full Code Here

      throw new IOException("Schema from file " + otherFile + " does not match");
    }
    // flush anything written so far
    writeBlock();
    Codec otherCodec = otherFile.resolveCodec();
    DataBlock nextBlockRaw = null;
    if (codec.equals(otherCodec) && !recompress) {
      // copy raw bytes
      while(otherFile.hasNextBlock()) {
        nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw);
        nextBlockRaw.writeBlockTo(vout, sync);
      }
    } else {
      while(otherFile.hasNextBlock()) {
        nextBlockRaw = otherFile.nextRawBlock(nextBlockRaw);
        nextBlockRaw.decompressUsing(otherCodec);
        nextBlockRaw.compressUsing(codec);
        nextBlockRaw.writeBlockTo(vout, sync);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.avro.file.DataFileStream.DataBlock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.