/** * Codecs must implement an equals() method. Two codecs, A and B are equal * if: the result of A and B decompressing content compressed by A is the same * AND the result of A and B decompressing content compressed by B is the same */ private boolean compareDecompress(Codec other, ByteBuffer original) throws IOException { ByteBuffer compressedA = this.compress(original); original.rewind(); ByteBuffer compressedB = other.compress(original); if (this.decompress(compressedA).equals(other.decompress((ByteBuffer) compressedA.rewind())) && this.decompress(compressedB).equals(other.decompress((ByteBuffer) compressedB.rewind())) ) { return true; } return false; }
@Override public String toString() { return getName(); } }
@Override public String toString() { Codec instance = this.createInstance(); return instance.toString(); }
Codec otherCodec = otherFile.resolveCodec(); DataBlock nextBlockRaw = null; if (codec.equals(otherCodec) && !recompress) { while(otherFile.hasNextBlock()) { nextBlockRaw = otherFile.nextBlock(nextBlockRaw); ByteBuffer uncompressedData = otherCodec.decompress(ByteBuffer.wrap( nextBlockRaw.data, 0, nextBlockRaw.blockSize)); ByteBuffer compressed = codec.compress(uncompressedData); nextBlockRaw.data = compressed.array(); nextBlockRaw.blockSize = compressed.remaining();
void decompressUsing(Codec c) throws IOException { ByteBuffer result = c.decompress(getAsByteBuffer()); data = result.array(); blockSize = result.remaining(); }
void compressUsing(Codec c) throws IOException { ByteBuffer result = c.compress(getAsByteBuffer()); data = result.array(); blockSize = result.remaining(); }
Codec otherCodec = otherFile.resolveCodec(); DataBlock nextBlockRaw = null; if (codec.equals(otherCodec) && !recompress) {
void decompressUsing(Codec c) throws IOException { ByteBuffer result = c.decompress(getAsByteBuffer()); data = result.array(); blockSize = result.remaining(); }
void compressUsing(Codec c) throws IOException { ByteBuffer result = c.compress(getAsByteBuffer()); data = result.array(); blockSize = result.remaining(); }
Codec otherCodec = otherFile.resolveCodec(); DataBlock nextBlockRaw = null; if (codec.equals(otherCodec) && !recompress) {
@Override public String toString() { return getName(); }
void decompressUsing(Codec c) throws IOException { ByteBuffer result = c.decompress(getAsByteBuffer()); data = result.array(); blockSize = result.remaining(); }
void compressUsing(Codec c) throws IOException { ByteBuffer result = c.compress(getAsByteBuffer()); data = result.array(); blockSize = result.remaining(); }
@Override public String toString() { Codec instance = this.createInstance(); return instance.toString(); }
Codec otherCodec = otherFile.resolveCodec(); DataBlock nextBlockRaw = null; if (codec.equals(otherCodec) && !recompress) {
/** * Configures this writer to use the given codec. * May not be reset after writes have begun. */ public DataFileWriter<D> setCodec(CodecFactory c) { assertNotOpen(); this.codec = c.createInstance(); setMetaInternal(DataFileConstants.CODEC, codec.getName()); return this; }
void decompressUsing(Codec c) throws IOException { ByteBuffer result = c.decompress(getAsByteBuffer()); data = result.array(); blockSize = result.remaining(); }
void compressUsing(Codec c) throws IOException { ByteBuffer result = c.compress(getAsByteBuffer()); data = result.array(); blockSize = result.remaining(); }
@Override public String toString() { Codec instance = this.createInstance(); return instance.toString(); }
Codec otherCodec = otherFile.resolveCodec(); DataBlock nextBlockRaw = null; if (codec.equals(otherCodec) && !recompress) {