Package org.bouncycastle.bcpg
Class BCPGOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.bouncycastle.bcpg.BCPGOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable,CompressionAlgorithmTags,PacketTags
public class BCPGOutputStream extends java.io.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(java.io.OutputStream out)BCPGOutputStream(java.io.OutputStream out, int tag)Create a stream representing an old style partial object.BCPGOutputStream(java.io.OutputStream out, int tag, byte[] buffer)Create a new style partial input stream buffered into chunks.BCPGOutputStream(java.io.OutputStream out, int tag, long length)BCPGOutputStream(java.io.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 voidclose()voidfinish()Finish writing out the current packet without closing the underlying stream.voidflush()Flush the underlying stream.voidwrite(byte[] bytes, int off, int len)voidwrite(int b)voidwriteObject(BCPGObject o)voidwritePacket(ContainedPacket p)
-
-
-
Constructor Detail
-
BCPGOutputStream
public BCPGOutputStream(java.io.OutputStream out)
-
BCPGOutputStream
public BCPGOutputStream(java.io.OutputStream out, int tag) throws java.io.IOExceptionCreate a stream representing an old style partial object.- Parameters:
tag- the packet tag for the object.- Throws:
java.io.IOException
-
BCPGOutputStream
public BCPGOutputStream(java.io.OutputStream out, int tag, long length, boolean oldFormat) throws java.io.IOExceptionCreate a stream representing a general packet.- Parameters:
out-tag-length-oldFormat-- Throws:
java.io.IOException
-
BCPGOutputStream
public BCPGOutputStream(java.io.OutputStream out, int tag, long length) throws java.io.IOException- Parameters:
tag-length-- Throws:
java.io.IOException
-
BCPGOutputStream
public BCPGOutputStream(java.io.OutputStream out, int tag, byte[] buffer) throws java.io.IOExceptionCreate 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:
java.io.IOException
-
-
Method Detail
-
write
public void write(int b) throws java.io.IOException- Specified by:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] bytes, int off, int len) throws java.io.IOException- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
writePacket
public void writePacket(ContainedPacket p) throws java.io.IOException
- Throws:
java.io.IOException
-
writeObject
public void writeObject(BCPGObject o) throws java.io.IOException
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOExceptionFlush the underlying stream.- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException
-
finish
public void finish() throws java.io.IOExceptionFinish writing out the current packet without closing the underlying stream.- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException
-
-