本文整理汇总了Java中com.jcraft.jzlib.InflaterInputStream类的典型用法代码示例。如果您正苦于以下问题:Java InflaterInputStream类的具体用法?Java InflaterInputStream怎么用?Java InflaterInputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InflaterInputStream类属于com.jcraft.jzlib包,在下文中一共展示了InflaterInputStream类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: read
import com.jcraft.jzlib.InflaterInputStream; //导入依赖的package包/类
public LiteralTableChunk read() throws Throwable {
LiteralTableChunk literalTableChunk = new LiteralTableChunk(chunk());
int uncompressedSize = read4Bytes();
byte[] uncompressed = new byte[uncompressedSize];
int offset = 0;
int left = uncompressedSize;
try (InflaterInputStream iis = new InflaterInputStream(inputStream())) {
do {
int decompressed = iis.read(uncompressed, offset, left);
offset += decompressed;
left -= decompressed;
} while (left > 0);
}
setInputStream(new DataInputStream(new ByteArrayInputStream(uncompressed)));
int literals = read4Bytes();
while (literals-- > 0) {
read4Bytes(); // length of literal
literalTableChunk.add(readTerm());
}
return literalTableChunk;
}
开发者ID:jerlang,项目名称:jerlang,代码行数:26,代码来源:LiteralTableChunkReader.java
示例2: uncompress
import com.jcraft.jzlib.InflaterInputStream; //导入依赖的package包/类
/**
* Uncompress.
*
* @param compressedData
* the compressed data
* @param uncompressedLength
* the uncompressed length
* @return the byte[]
*/
protected byte[] uncompress(final byte[] compressedData, final long uncompressedLength) {
final byte[] uncompressedData = new byte[(int) uncompressedLength];
try {
final ByteArrayInputStream input = new ByteArrayInputStream(compressedData);
final InflaterInputStream decompressor = new InflaterInputStream(input);
decompressor.read(uncompressedData);
decompressor.close();
} catch (final IOException e) {
throw new IllegalArgumentException(e);
}
return uncompressedData;
}
开发者ID:biomojo,项目名称:biomojo,代码行数:22,代码来源:ZLibByteCodec.java
示例3: getInputStream
import com.jcraft.jzlib.InflaterInputStream; //导入依赖的package包/类
@Override
public InputStream getInputStream(InputStream inputStream) throws IOException {
final InflaterInputStream is = new InflaterInputStream(inputStream);
return is;
}
开发者ID:TTalkIM,项目名称:Smack,代码行数:7,代码来源:JzlibInputOutputStream.java
注:本文中的com.jcraft.jzlib.InflaterInputStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论