本文整理汇总了Java中org.bouncycastle.bcpg.CompressionAlgorithmTags.ZLIB属性的典型用法代码示例。如果您正苦于以下问题:Java CompressionAlgorithmTags.ZLIB属性的具体用法?Java CompressionAlgorithmTags.ZLIB怎么用?Java CompressionAlgorithmTags.ZLIB使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bouncycastle.bcpg.CompressionAlgorithmTags
的用法示例。
在下文中一共展示了CompressionAlgorithmTags.ZLIB属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PGPCompressedDataGenerator
public PGPCompressedDataGenerator(
int algorithm,
int compression)
{
switch (algorithm)
{
case CompressionAlgorithmTags.UNCOMPRESSED:
case CompressionAlgorithmTags.ZIP:
case CompressionAlgorithmTags.ZLIB:
case CompressionAlgorithmTags.BZIP2:
break;
default:
throw new IllegalArgumentException("unknown compression algorithm");
}
if (compression != Deflater.DEFAULT_COMPRESSION)
{
if ((compression < Deflater.NO_COMPRESSION) || (compression > Deflater.BEST_COMPRESSION))
{
throw new IllegalArgumentException("unknown compression level: " + compression);
}
}
this.algorithm = algorithm;
this.compression = compression;
}
示例2: doOpen
private void doOpen() throws IOException
{
pkOut.write(algorithm);
switch (algorithm)
{
case CompressionAlgorithmTags.UNCOMPRESSED:
dOut = pkOut;
break;
case CompressionAlgorithmTags.ZIP:
dOut = new SafeDeflaterOutputStream(pkOut, compression, true);
break;
case CompressionAlgorithmTags.ZLIB:
dOut = new SafeDeflaterOutputStream(pkOut, compression, false);
break;
case CompressionAlgorithmTags.BZIP2:
dOut = new SafeCBZip2OutputStream(pkOut);
break;
default:
// Constructor should guard against this possibility
throw new IllegalStateException();
}
}