Package org.bouncycastle.bcpg
Class BCPGOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.bouncycastle.bcpg.BCPGOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
,CompressionAlgorithmTags
,PacketTags
public class BCPGOutputStream extends OutputStream implements PacketTags, CompressionAlgorithmTags
Basic output stream.
-
-
Field Summary
-
Fields inherited from interface org.bouncycastle.bcpg.CompressionAlgorithmTags
BZIP2, UNCOMPRESSED, ZIP, ZLIB
-
Fields inherited from interface org.bouncycastle.bcpg.PacketTags
COMPRESSED_DATA, EXPERIMENTAL_1, EXPERIMENTAL_2, EXPERIMENTAL_3, EXPERIMENTAL_4, LITERAL_DATA, MARKER, MOD_DETECTION_CODE, ONE_PASS_SIGNATURE, PUBLIC_KEY, PUBLIC_KEY_ENC_SESSION, PUBLIC_SUBKEY, RESERVED, SECRET_KEY, SECRET_SUBKEY, SIGNATURE, SYM_ENC_INTEGRITY_PRO, SYMMETRIC_KEY_ENC, SYMMETRIC_KEY_ENC_SESSION, TRUST, USER_ATTRIBUTE, USER_ID
-
-
Constructor Summary
Constructors Constructor Description BCPGOutputStream(OutputStream out)
BCPGOutputStream(OutputStream out, int tag)
Create a stream representing an old style partial object.BCPGOutputStream(OutputStream out, int tag, byte[] buffer)
Create a new style partial input stream buffered into chunks.BCPGOutputStream(OutputStream out, int tag, long length)
BCPGOutputStream(OutputStream out, int tag, long length, boolean oldFormat)
Create a stream representing a general packet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
finish()
Finish writing out the current packet without closing the underlying stream.void
flush()
Flush the underlying stream.void
write(byte[] bytes, int off, int len)
void
write(int b)
void
writeObject(BCPGObject o)
void
writePacket(ContainedPacket p)
-
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
-
-
-
Constructor Detail
-
BCPGOutputStream
public BCPGOutputStream(OutputStream out)
-
BCPGOutputStream
public BCPGOutputStream(OutputStream out, int tag) throws IOException
Create a stream representing an old style partial object.- Parameters:
tag
- the packet tag for the object.- Throws:
IOException
-
BCPGOutputStream
public BCPGOutputStream(OutputStream out, int tag, long length, boolean oldFormat) throws IOException
Create a stream representing a general packet.- Parameters:
out
-tag
-length
-oldFormat
-- Throws:
IOException
-
BCPGOutputStream
public BCPGOutputStream(OutputStream out, int tag, long length) throws IOException
- Parameters:
tag
-length
-- Throws:
IOException
-
BCPGOutputStream
public BCPGOutputStream(OutputStream out, int tag, byte[] buffer) throws IOException
Create a new style partial input stream buffered into chunks.- Parameters:
out
- output stream to write to.tag
- packet tag.buffer
- size of chunks making up the packet.- Throws:
IOException
-
-
Method Detail
-
write
public void write(int b) throws IOException
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] bytes, int off, int len) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
writePacket
public void writePacket(ContainedPacket p) throws IOException
- Throws:
IOException
-
writeObject
public void writeObject(BCPGObject o) throws IOException
- Throws:
IOException
-
flush
public void flush() throws IOException
Flush the underlying stream.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
finish
public void finish() throws IOException
Finish writing out the current packet without closing the underlying stream.- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
-