本文整理汇总了Java中com.jcraft.jzlib.Deflater类的典型用法代码示例。如果您正苦于以下问题:Java Deflater类的具体用法?Java Deflater怎么用?Java Deflater使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Deflater类属于com.jcraft.jzlib包,在下文中一共展示了Deflater类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: SpdyHeaderBlockZlibCompressor
import com.jcraft.jzlib.Deflater; //导入依赖的package包/类
public SpdyHeaderBlockZlibCompressor(int version, int compressionLevel) throws GZIPException {
if (version < SPDY_MIN_VERSION || version > SPDY_MAX_VERSION) {
throw new IllegalArgumentException(
"unsupported version: " + version);
}
if (compressionLevel < 0 || compressionLevel > 9) {
throw new IllegalArgumentException(
"compressionLevel: " + compressionLevel + " (expected: 0-9)");
}
compressor = new Deflater(compressionLevel);
if (version < 3) {
compressor.setDictionary(SPDY2_DICT, SPDY2_DICT.length);
} else {
compressor.setDictionary(SPDY_DICT, SPDY_DICT.length);
}
}
开发者ID:jle,项目名称:andy,代码行数:17,代码来源:SpdyHeaderBlockZlibCompressor.java
示例2: TDeflater
import com.jcraft.jzlib.Deflater; //导入依赖的package包/类
public TDeflater(int level, boolean noHeader) {
super();
if (level < DEFAULT_COMPRESSION || level > BEST_COMPRESSION) {
throw new IllegalArgumentException();
}
compressLevel = level;
try {
impl = new Deflater(compressLevel, strategy, noHeader);
} catch (GZIPException e) {
// do nothing
}
nowrap = noHeader;
}
开发者ID:konsoletyper,项目名称:teavm,代码行数:14,代码来源:TDeflater.java
示例3: compressBuffer
import com.jcraft.jzlib.Deflater; //导入依赖的package包/类
private static byte[] compressBuffer(byte[] rawBuffer) throws IOException {
Deflater deflater = new Deflater();
deflater.init(JZlib.Z_DEFAULT_COMPRESSION, 27, 9);
ByteArrayOutputStream out = new ByteArrayOutputStream();
DeflaterOutputStream dos = new DeflaterOutputStream(out, deflater);
dos.write(rawBuffer);
dos.flush();
dos.close();
return out.toByteArray();
}
开发者ID:schierla,项目名称:jbeagle,代码行数:11,代码来源:BeagleCompressor.java
示例4: fail
import com.jcraft.jzlib.Deflater; //导入依赖的package包/类
static void fail(Deflater z, String message, int resultCode) {
throw deflaterException(z, message, resultCode);
}
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:4,代码来源:ZlibUtil.java
示例5: deflaterException
import com.jcraft.jzlib.Deflater; //导入依赖的package包/类
static CompressionException deflaterException(Deflater z, String message, int resultCode) {
return new CompressionException(message + " (" + resultCode + ')' + (z.msg != null? ": " + z.msg : ""));
}
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:4,代码来源:ZlibUtil.java
注:本文中的com.jcraft.jzlib.Deflater类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论