Package org.bouncycastle.openpgp
Class PGPCompressedData
- java.lang.Object
-
- org.bouncycastle.openpgp.PGPCompressedData
-
- All Implemented Interfaces:
CompressionAlgorithmTags
public class PGPCompressedData extends java.lang.Object implements CompressionAlgorithmTags
A PGP compressed data object.
-
-
Field Summary
-
Fields inherited from interface org.bouncycastle.bcpg.CompressionAlgorithmTags
BZIP2, UNCOMPRESSED, ZIP, ZLIB
-
-
Constructor Summary
Constructors Constructor Description PGPCompressedData(byte[] encData)Construct a PGP compressed data object from the passed in byte array.PGPCompressedData(java.io.InputStream inStream)Construct a PGP compressed data object from the passed in input stream.PGPCompressedData(BCPGInputStream pIn)Construct a compressed data object, reading a singlePacketTags.COMPRESSED_DATApacket from the stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetAlgorithm()Return thecompression algorithmused for this packet.java.io.InputStreamgetDataStream()Return an input stream that decompresses and returns data in the compressed packet.java.io.InputStreamgetInputStream()Return the raw input stream contained in the object.
-
-
-
Constructor Detail
-
PGPCompressedData
public PGPCompressedData(byte[] encData) throws java.io.IOExceptionConstruct a PGP compressed data object from the passed in byte array.- Parameters:
encData- an encoding of PGP compressed data.- Throws:
java.io.IOException- if an error occurs reading from the PGP input.
-
PGPCompressedData
public PGPCompressedData(java.io.InputStream inStream) throws java.io.IOExceptionConstruct a PGP compressed data object from the passed in input stream.- Parameters:
inStream- an input stream containing an encoding of PGP compressed data.- Throws:
java.io.IOException- if an error occurs reading from the PGP input.
-
PGPCompressedData
public PGPCompressedData(BCPGInputStream pIn) throws java.io.IOException
Construct a compressed data object, reading a singlePacketTags.COMPRESSED_DATApacket from the stream.- Parameters:
pIn- a PGP input stream, with a compressed data packet as the current packet.- Throws:
java.io.IOException- if an error occurs reading the packet from the stream.
-
-
Method Detail
-
getAlgorithm
public int getAlgorithm()
Return thecompression algorithmused for this packet.- Returns:
- the compression algorithm code
-
getInputStream
public java.io.InputStream getInputStream()
Return the raw input stream contained in the object.Note that this stream is shared with the decompression stream, so consuming the returned stream will affect decompression.
- Returns:
- the raw data in the compressed data packet.
-
getDataStream
public java.io.InputStream getDataStream() throws PGPExceptionReturn an input stream that decompresses and returns data in the compressed packet.- Returns:
- a stream over the uncompressed data.
- Throws:
PGPException- if an error occurs constructing the decompression stream.
-
-