Table of Contents

Class BcpgOutputStream

Namespace
Org.BouncyCastle.Bcpg
Assembly
BouncyCastle.Cryptography.dll
public class BcpgOutputStream : BaseOutputStream, IAsyncDisposable, IDisposable
Inheritance
BcpgOutputStream
Implements
Inherited Members

Remarks

Basic output stream.

Constructors

BcpgOutputStream(Stream)

Create a stream representing a general packet.

public BcpgOutputStream(Stream outStr)

Parameters

outStr Stream

Output stream to write to.

BcpgOutputStream(Stream, PacketTag)

Create a stream representing an old style partial object.

public BcpgOutputStream(Stream outStr, PacketTag tag)

Parameters

outStr Stream

Output stream to write to.

tag PacketTag

The packet tag for the object.

BcpgOutputStream(Stream, PacketTag, byte[])

Create a new style partial input stream buffered into chunks.

public BcpgOutputStream(Stream outStr, PacketTag tag, byte[] buffer)

Parameters

outStr Stream

Output stream to write to.

tag PacketTag

Packet tag.

buffer byte[]

Buffer to use for collecting chunks.

BcpgOutputStream(Stream, PacketTag, long)

Create a new style partial input stream buffered into chunks.

public BcpgOutputStream(Stream outStr, PacketTag tag, long length)

Parameters

outStr Stream

Output stream to write to.

tag PacketTag

Packet tag.

length long

Size of chunks making up the packet.

BcpgOutputStream(Stream, PacketTag, long, bool)

Create a stream representing a general packet.

public BcpgOutputStream(Stream outStr, PacketTag tag, long length, bool oldFormat)

Parameters

outStr Stream

Output stream to write to.

tag PacketTag

Packet tag.

length long

Size of chunks making up the packet.

oldFormat bool

If true, the header is written out in old format.

BcpgOutputStream(Stream, bool)

Base constructor specifying whether or not to use packets in the new format wherever possible.

public BcpgOutputStream(Stream outStr, bool newFormatOnly)

Parameters

outStr Stream

Output stream to write to.

newFormatOnly bool

true if use new format packets, false if backwards compatible preferred.

Methods

Dispose(bool)

Releases the unmanaged resources used by the Stream and optionally releases the managed resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

Finish()

Finish writing out the current packet without closing the underlying stream.

public void Finish()

Flush()

Flush the underlying stream.

public override void Flush()

Write(byte[], int, int)

When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

public override void Write(byte[] buffer, int offset, int count)

Parameters

buffer byte[]

An array of bytes. This method copies count bytes from buffer to the current stream.

offset int

The zero-based byte offset in buffer at which to begin copying bytes to the current stream.

count int

The number of bytes to be written to the current stream.

Exceptions

ArgumentException

The sum of offset and count is greater than the buffer length.

ArgumentNullException

buffer is null.

ArgumentOutOfRangeException

offset or count is negative.

IOException

An I/O error occurred, such as the specified file cannot be found.

NotSupportedException

The stream does not support writing.

ObjectDisposedException

Write(byte[], int, int) was called after the stream was closed.

Write(ReadOnlySpan<byte>)

When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

public override void Write(ReadOnlySpan<byte> buffer)

Parameters

buffer ReadOnlySpan<byte>

A region of memory. This method copies the contents of this region to the current stream.

WriteByte(byte)

Writes a byte to the current position in the stream and advances the position within the stream by one byte.

public override void WriteByte(byte value)

Parameters

value byte

The byte to write to the stream.

Exceptions

IOException

An I/O error occurs.

NotSupportedException

The stream does not support writing, or the stream is already closed.

ObjectDisposedException

Methods were called after the stream was closed.

WriteObject(BcpgObject)

public void WriteObject(BcpgObject bcpgObject)

Parameters

bcpgObject BcpgObject

WriteObjects(params BcpgObject[])

public void WriteObjects(params BcpgObject[] v)

Parameters

v BcpgObject[]

WritePacket(ContainedPacket)

public void WritePacket(ContainedPacket p)

Parameters

p ContainedPacket