本文整理汇总了Java中org.bouncycastle.openpgp.PGPLiteralData.getDataStream方法的典型用法代码示例。如果您正苦于以下问题:Java PGPLiteralData.getDataStream方法的具体用法?Java PGPLiteralData.getDataStream怎么用?Java PGPLiteralData.getDataStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.openpgp.PGPLiteralData
的用法示例。
在下文中一共展示了PGPLiteralData.getDataStream方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkLiteralData
import org.bouncycastle.openpgp.PGPLiteralData; //导入方法依赖的package包/类
private void checkLiteralData(PGPLiteralData ld, byte[] data)
throws IOException
{
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
if (!ld.getFileName().equals(PGPLiteralData.CONSOLE))
{
throw new RuntimeException("wrong filename in packet");
}
InputStream inLd = ld.getDataStream();
int ch;
while ((ch = inLd.read()) >= 0)
{
bOut.write(ch);
}
if (!areEqual(bOut.toByteArray(), data))
{
fail("wrong plain text in decrypted packet");
}
}
示例2: openInput
import org.bouncycastle.openpgp.PGPLiteralData; //导入方法依赖的package包/类
/**
* Opens a new {@link Input} for reading the original contents (Reading Step 3/3)
*
* <p>This is the final step in reading a ghostryde file. After calling this method, you should
* call the read methods on the returned {@link InputStream}.
*
* @param input is the value returned by {@link #openDecompressor}.
* @throws IOException
* @throws PGPException
*/
@CheckReturnValue
public Input openInput(@WillNotClose Decompressor input) throws IOException, PGPException {
PGPObjectFactory fact = new BcPGPObjectFactory(checkNotNull(input, "input"));
PGPLiteralData literal = pgpCast(fact.nextObject(), PGPLiteralData.class);
DateTime modified = new DateTime(literal.getModificationTime(), UTC);
return new Input(literal.getDataStream(), literal.getFileName(), modified);
}