/** * Creates a new customizable LZ4 decoder. * * @param factory user customizable {@link LZ4Factory} instance * which may be JNI bindings to the original C implementation, a pure Java implementation * or a Java implementation that uses the {@link sun.misc.Unsafe} * @param checksum the {@link Checksum} instance to use to check data for integrity. * You may set {@code null} if you do not want to validate checksum of each block */ public Lz4FrameDecoder(LZ4Factory factory, Checksum checksum) { if (factory == null) { throw new NullPointerException("factory"); } decompressor = factory.fastDecompressor(); this.checksum = checksum == null ? null : ByteBufChecksum.wrapChecksum(checksum); }
private JdkZlibDecoder(ZlibWrapper wrapper, byte[] dictionary, boolean decompressConcatenated) { if (wrapper == null) { throw new NullPointerException("wrapper"); } this.decompressConcatenated = decompressConcatenated; switch (wrapper) { case GZIP: inflater = new Inflater(true); crc = ByteBufChecksum.wrapChecksum(new CRC32()); break; case NONE: inflater = new Inflater(true); crc = null; break; case ZLIB: inflater = new Inflater(); crc = null; break; case ZLIB_OR_NONE: // Postpone the decision until decode(...) is called. decideZlibOrNone = true; crc = null; break; default: throw new IllegalArgumentException("Only GZIP or ZLIB is supported, but you used " + wrapper); } this.dictionary = dictionary; }
/** * Creates a new customizable LZ4 decoder. * * @param factory user customizable {@link LZ4Factory} instance * which may be JNI bindings to the original C implementation, a pure Java implementation * or a Java implementation that uses the {@link sun.misc.Unsafe} * @param checksum the {@link Checksum} instance to use to check data for integrity. * You may set {@code null} if you do not want to validate checksum of each block */ public Lz4FrameDecoder(LZ4Factory factory, Checksum checksum) { if (factory == null) { throw new NullPointerException("factory"); } decompressor = factory.fastDecompressor(); this.checksum = checksum == null ? null : ByteBufChecksum.wrapChecksum(checksum); }
private JdkZlibDecoder(ZlibWrapper wrapper, byte[] dictionary, boolean decompressConcatenated) { if (wrapper == null) { throw new NullPointerException("wrapper"); } this.decompressConcatenated = decompressConcatenated; switch (wrapper) { case GZIP: inflater = new Inflater(true); crc = ByteBufChecksum.wrapChecksum(new CRC32()); break; case NONE: inflater = new Inflater(true); crc = null; break; case ZLIB: inflater = new Inflater(); crc = null; break; case ZLIB_OR_NONE: // Postpone the decision until decode(...) is called. decideZlibOrNone = true; crc = null; break; default: throw new IllegalArgumentException("Only GZIP or ZLIB is supported, but you used " + wrapper); } this.dictionary = dictionary; }
/** * Creates a new customizable LZ4 decoder. * * @param factory user customizable {@link LZ4Factory} instance * which may be JNI bindings to the original C implementation, a pure Java implementation * or a Java implementation that uses the {@link sun.misc.Unsafe} * @param checksum the {@link Checksum} instance to use to check data for integrity. * You may set {@code null} if you do not want to validate checksum of each block */ public Lz4FrameDecoder(LZ4Factory factory, Checksum checksum) { if (factory == null) { throw new NullPointerException("factory"); } decompressor = factory.fastDecompressor(); this.checksum = checksum == null ? null : ByteBufChecksum.wrapChecksum(checksum); }
private JdkZlibDecoder(ZlibWrapper wrapper, byte[] dictionary, boolean decompressConcatenated) { if (wrapper == null) { throw new NullPointerException("wrapper"); } this.decompressConcatenated = decompressConcatenated; switch (wrapper) { case GZIP: inflater = new Inflater(true); crc = ByteBufChecksum.wrapChecksum(new CRC32()); break; case NONE: inflater = new Inflater(true); crc = null; break; case ZLIB: inflater = new Inflater(); crc = null; break; case ZLIB_OR_NONE: // Postpone the decision until decode(...) is called. decideZlibOrNone = true; crc = null; break; default: throw new IllegalArgumentException("Only GZIP or ZLIB is supported, but you used " + wrapper); } this.dictionary = dictionary; }
/** * Creates a new customizable LZ4 encoder. * * @param factory user customizable {@link LZ4Factory} instance * which may be JNI bindings to the original C implementation, a pure Java implementation * or a Java implementation that uses the {@link sun.misc.Unsafe} * @param highCompressor if {@code true} codec will use compressor which requires more memory * and is slower but compresses more efficiently * @param blockSize the maximum number of bytes to try to compress at once, * must be >= 64 and <= 32 M * @param checksum the {@link Checksum} instance to use to check data for integrity * @param maxEncodeSize the maximum size for an encode (compressed) buffer */ public Lz4FrameEncoder(LZ4Factory factory, boolean highCompressor, int blockSize, Checksum checksum, int maxEncodeSize) { if (factory == null) { throw new NullPointerException("factory"); } if (checksum == null) { throw new NullPointerException("checksum"); } compressor = highCompressor ? factory.highCompressor() : factory.fastCompressor(); this.checksum = ByteBufChecksum.wrapChecksum(checksum); compressionLevel = compressionLevel(blockSize); this.blockSize = blockSize; this.maxEncodeSize = ObjectUtil.checkPositive(maxEncodeSize, "maxEncodeSize"); finished = false; }
/** * Creates a new customizable LZ4 encoder. * * @param factory user customizable {@link LZ4Factory} instance * which may be JNI bindings to the original C implementation, a pure Java implementation * or a Java implementation that uses the {@link sun.misc.Unsafe} * @param highCompressor if {@code true} codec will use compressor which requires more memory * and is slower but compresses more efficiently * @param blockSize the maximum number of bytes to try to compress at once, * must be >= 64 and <= 32 M * @param checksum the {@link Checksum} instance to use to check data for integrity * @param maxEncodeSize the maximum size for an encode (compressed) buffer */ public Lz4FrameEncoder(LZ4Factory factory, boolean highCompressor, int blockSize, Checksum checksum, int maxEncodeSize) { if (factory == null) { throw new NullPointerException("factory"); } if (checksum == null) { throw new NullPointerException("checksum"); } compressor = highCompressor ? factory.highCompressor() : factory.fastCompressor(); this.checksum = ByteBufChecksum.wrapChecksum(checksum); compressionLevel = compressionLevel(blockSize); this.blockSize = blockSize; this.maxEncodeSize = ObjectUtil.checkPositive(maxEncodeSize, "maxEncodeSize"); finished = false; }
/** * Creates a new customizable LZ4 encoder. * * @param factory user customizable {@link LZ4Factory} instance * which may be JNI bindings to the original C implementation, a pure Java implementation * or a Java implementation that uses the {@link sun.misc.Unsafe} * @param highCompressor if {@code true} codec will use compressor which requires more memory * and is slower but compresses more efficiently * @param blockSize the maximum number of bytes to try to compress at once, * must be >= 64 and <= 32 M * @param checksum the {@link Checksum} instance to use to check data for integrity * @param maxEncodeSize the maximum size for an encode (compressed) buffer */ public Lz4FrameEncoder(LZ4Factory factory, boolean highCompressor, int blockSize, Checksum checksum, int maxEncodeSize) { if (factory == null) { throw new NullPointerException("factory"); } if (checksum == null) { throw new NullPointerException("checksum"); } compressor = highCompressor ? factory.highCompressor() : factory.fastCompressor(); this.checksum = ByteBufChecksum.wrapChecksum(checksum); compressionLevel = compressionLevel(blockSize); this.blockSize = blockSize; this.maxEncodeSize = ObjectUtil.checkPositive(maxEncodeSize, "maxEncodeSize"); finished = false; }
private JdkZlibDecoder(ZlibWrapper wrapper, byte[] dictionary, boolean decompressConcatenated) { if (wrapper == null) { throw new NullPointerException("wrapper"); } this.decompressConcatenated = decompressConcatenated; switch (wrapper) { case GZIP: inflater = new Inflater(true); crc = ByteBufChecksum.wrapChecksum(new CRC32()); break; case NONE: inflater = new Inflater(true); crc = null; break; case ZLIB: inflater = new Inflater(); crc = null; break; case ZLIB_OR_NONE: // Postpone the decision until decode(...) is called. decideZlibOrNone = true; crc = null; break; default: throw new IllegalArgumentException("Only GZIP or ZLIB is supported, but you used " + wrapper); } this.dictionary = dictionary; }
/** * Creates a new customizable LZ4 decoder. * * @param factory user customizable {@link LZ4Factory} instance * which may be JNI bindings to the original C implementation, a pure Java implementation * or a Java implementation that uses the {@link sun.misc.Unsafe} * @param checksum the {@link Checksum} instance to use to check data for integrity. * You may set {@code null} if you do not want to validate checksum of each block */ public Lz4FrameDecoder(LZ4Factory factory, Checksum checksum) { if (factory == null) { throw new NullPointerException("factory"); } decompressor = factory.fastDecompressor(); this.checksum = checksum == null ? null : ByteBufChecksum.wrapChecksum(checksum); }
/** * Creates a new customizable LZ4 decoder. * * @param factory user customizable {@link LZ4Factory} instance * which may be JNI bindings to the original C implementation, a pure Java implementation * or a Java implementation that uses the {@link sun.misc.Unsafe} * @param checksum the {@link Checksum} instance to use to check data for integrity. * You may set {@code null} if you do not want to validate checksum of each block */ public Lz4FrameDecoder(LZ4Factory factory, Checksum checksum) { if (factory == null) { throw new NullPointerException("factory"); } decompressor = factory.fastDecompressor(); this.checksum = checksum == null ? null : ByteBufChecksum.wrapChecksum(checksum); }
/** * Creates a new customizable LZ4 decoder. * * @param factory user customizable {@link LZ4Factory} instance * which may be JNI bindings to the original C implementation, a pure Java implementation * or a Java implementation that uses the {@link sun.misc.Unsafe} * @param checksum the {@link Checksum} instance to use to check data for integrity. * You may set {@code null} if you do not want to validate checksum of each block */ public Lz4FrameDecoder(LZ4Factory factory, Checksum checksum) { if (factory == null) { throw new NullPointerException("factory"); } decompressor = factory.fastDecompressor(); this.checksum = checksum == null ? null : ByteBufChecksum.wrapChecksum(checksum); }
/** * Creates a new customizable LZ4 decoder. * * @param factory user customizable {@link LZ4Factory} instance * which may be JNI bindings to the original C implementation, a pure Java implementation * or a Java implementation that uses the {@link sun.misc.Unsafe} * @param checksum the {@link Checksum} instance to use to check data for integrity. * You may set {@code null} if you do not want to validate checksum of each block */ public Lz4FrameDecoder(LZ4Factory factory, Checksum checksum) { if (factory == null) { throw new NullPointerException("factory"); } decompressor = factory.fastDecompressor(); this.checksum = checksum == null ? null : ByteBufChecksum.wrapChecksum(checksum); }
private JdkZlibDecoder(ZlibWrapper wrapper, byte[] dictionary, boolean decompressConcatenated) { if (wrapper == null) { throw new NullPointerException("wrapper"); } this.decompressConcatenated = decompressConcatenated; switch (wrapper) { case GZIP: inflater = new Inflater(true); crc = ByteBufChecksum.wrapChecksum(new CRC32()); break; case NONE: inflater = new Inflater(true); crc = null; break; case ZLIB: inflater = new Inflater(); crc = null; break; case ZLIB_OR_NONE: // Postpone the decision until decode(...) is called. decideZlibOrNone = true; crc = null; break; default: throw new IllegalArgumentException("Only GZIP or ZLIB is supported, but you used " + wrapper); } this.dictionary = dictionary; }
private JdkZlibDecoder(ZlibWrapper wrapper, byte[] dictionary, boolean decompressConcatenated) { if (wrapper == null) { throw new NullPointerException("wrapper"); } this.decompressConcatenated = decompressConcatenated; switch (wrapper) { case GZIP: inflater = new Inflater(true); crc = ByteBufChecksum.wrapChecksum(new CRC32()); break; case NONE: inflater = new Inflater(true); crc = null; break; case ZLIB: inflater = new Inflater(); crc = null; break; case ZLIB_OR_NONE: // Postpone the decision until decode(...) is called. decideZlibOrNone = true; crc = null; break; default: throw new IllegalArgumentException("Only GZIP or ZLIB is supported, but you used " + wrapper); } this.dictionary = dictionary; }
private JdkZlibDecoder(ZlibWrapper wrapper, byte[] dictionary, boolean decompressConcatenated) { if (wrapper == null) { throw new NullPointerException("wrapper"); } this.decompressConcatenated = decompressConcatenated; switch (wrapper) { case GZIP: inflater = new Inflater(true); crc = ByteBufChecksum.wrapChecksum(new CRC32()); break; case NONE: inflater = new Inflater(true); crc = null; break; case ZLIB: inflater = new Inflater(); crc = null; break; case ZLIB_OR_NONE: // Postpone the decision until decode(...) is called. decideZlibOrNone = true; crc = null; break; default: throw new IllegalArgumentException("Only GZIP or ZLIB is supported, but you used " + wrapper); } this.dictionary = dictionary; }
/** * Creates a new customizable LZ4 encoder. * * @param factory user customizable {@link LZ4Factory} instance * which may be JNI bindings to the original C implementation, a pure Java implementation * or a Java implementation that uses the {@link sun.misc.Unsafe} * @param highCompressor if {@code true} codec will use compressor which requires more memory * and is slower but compresses more efficiently * @param blockSize the maximum number of bytes to try to compress at once, * must be >= 64 and <= 32 M * @param checksum the {@link Checksum} instance to use to check data for integrity * @param maxEncodeSize the maximum size for an encode (compressed) buffer */ public Lz4FrameEncoder(LZ4Factory factory, boolean highCompressor, int blockSize, Checksum checksum, int maxEncodeSize) { if (factory == null) { throw new NullPointerException("factory"); } if (checksum == null) { throw new NullPointerException("checksum"); } compressor = highCompressor ? factory.highCompressor() : factory.fastCompressor(); this.checksum = ByteBufChecksum.wrapChecksum(checksum); compressionLevel = compressionLevel(blockSize); this.blockSize = blockSize; this.maxEncodeSize = ObjectUtil.checkPositive(maxEncodeSize, "maxEncodeSize"); finished = false; }
/** * Creates a new customizable LZ4 encoder. * * @param factory user customizable {@link LZ4Factory} instance * which may be JNI bindings to the original C implementation, a pure Java implementation * or a Java implementation that uses the {@link sun.misc.Unsafe} * @param highCompressor if {@code true} codec will use compressor which requires more memory * and is slower but compresses more efficiently * @param blockSize the maximum number of bytes to try to compress at once, * must be >= 64 and <= 32 M * @param checksum the {@link Checksum} instance to use to check data for integrity * @param maxEncodeSize the maximum size for an encode (compressed) buffer */ public Lz4FrameEncoder(LZ4Factory factory, boolean highCompressor, int blockSize, Checksum checksum, int maxEncodeSize) { if (factory == null) { throw new NullPointerException("factory"); } if (checksum == null) { throw new NullPointerException("checksum"); } compressor = highCompressor ? factory.highCompressor() : factory.fastCompressor(); this.checksum = ByteBufChecksum.wrapChecksum(checksum); compressionLevel = compressionLevel(blockSize); this.blockSize = blockSize; this.maxEncodeSize = ObjectUtil.checkPositive(maxEncodeSize, "maxEncodeSize"); finished = false; }
/** * Creates a new customizable LZ4 encoder. * * @param factory user customizable {@link LZ4Factory} instance * which may be JNI bindings to the original C implementation, a pure Java implementation * or a Java implementation that uses the {@link sun.misc.Unsafe} * @param highCompressor if {@code true} codec will use compressor which requires more memory * and is slower but compresses more efficiently * @param blockSize the maximum number of bytes to try to compress at once, * must be >= 64 and <= 32 M * @param checksum the {@link Checksum} instance to use to check data for integrity * @param maxEncodeSize the maximum size for an encode (compressed) buffer */ public Lz4FrameEncoder(LZ4Factory factory, boolean highCompressor, int blockSize, Checksum checksum, int maxEncodeSize) { if (factory == null) { throw new NullPointerException("factory"); } if (checksum == null) { throw new NullPointerException("checksum"); } compressor = highCompressor ? factory.highCompressor() : factory.fastCompressor(); this.checksum = ByteBufChecksum.wrapChecksum(checksum); compressionLevel = compressionLevel(blockSize); this.blockSize = blockSize; this.maxEncodeSize = ObjectUtil.checkPositive(maxEncodeSize, "maxEncodeSize"); finished = false; }