Class BZip2OutputStream
An output stream that compresses into the BZip2 format including file header chars into another stream.
Inheritance
Implements
Inherited Members
Namespace: ICSharpCode.SharpZipLib.BZip2
Assembly: ICSharpCode.SharpZipLib.dll
Syntax
public class BZip2OutputStream : Stream, IDisposable
Constructors
| Improve this Doc View SourceBZip2OutputStream(Stream)
Construct a default output stream with maximum block size
Declaration
public BZip2OutputStream(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream to write BZip data onto. |
BZip2OutputStream(Stream, Int32)
Initialise a new instance of the BZip2OutputStream for the specified stream, using the given blocksize.
Declaration
public BZip2OutputStream(Stream stream, int blockSize)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream to write compressed data to. |
System.Int32 | blockSize | The block size to use. |
Remarks
Valid block sizes are in the range 1..9, with 1 giving the lowest compression and 9 the highest.
Properties
| Improve this Doc View SourceBytesWritten
Get the number of bytes written to the output.
Declaration
public int BytesWritten { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
CanRead
Gets a value indicating whether the current stream supports reading
Declaration
public override bool CanRead { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
CanSeek
Gets a value indicating whether the current stream supports seeking
Declaration
public override bool CanSeek { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
CanWrite
Gets a value indicating whether the current stream supports writing
Declaration
public override bool CanWrite { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
IsStreamOwner
Gets or sets a flag indicating ownership of underlying stream. When the flag is true System.IO.Stream.Dispose() will close the underlying stream also.
Declaration
public bool IsStreamOwner { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The default value is true.
Length
Gets the length in bytes of the stream
Declaration
public override long Length { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
Overrides
Position
Gets or sets the current position of this stream.
Declaration
public override long Position { get; set; }
Property Value
Type | Description |
---|---|
System.Int64 |
Overrides
Methods
| Improve this Doc View SourceDispose(Boolean)
Releases the unmanaged resources used by the BZip2OutputStream and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Overrides
Finalize()
Ensures that resources are freed and other cleanup operations are performed when the garbage collector reclaims the BZip2OutputStream.
Declaration
protected void Finalize()
Flush()
Flush output buffers
Declaration
public override void Flush()
Overrides
Read(Byte[], Int32, Int32)
Read a block of bytes
Declaration
public override int Read(byte[] buffer, int offset, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer to read into. |
System.Int32 | offset | The offset in the buffer to start storing data at. |
System.Int32 | count | The maximum number of bytes to read. |
Returns
Type | Description |
---|---|
System.Int32 | The total number of bytes read. This might be less than the number of bytes requested if that number of bytes are not currently available, or zero if the end of the stream is reached. |
Overrides
ReadByte()
Read a byte from the stream advancing the position.
Declaration
public override int ReadByte()
Returns
Type | Description |
---|---|
System.Int32 | The byte read cast to an int; -1 if end of stream. |
Overrides
Seek(Int64, SeekOrigin)
Sets the current position of this stream to the given value.
Declaration
public override long Seek(long offset, SeekOrigin origin)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | offset | The point relative to the offset from which to being seeking. |
System.IO.SeekOrigin | origin | The reference point from which to begin seeking. |
Returns
Type | Description |
---|---|
System.Int64 | The new position in the stream. |
Overrides
SetLength(Int64)
Sets the length of this stream to the given value.
Declaration
public override void SetLength(long value)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | value | The new stream length. |
Overrides
Write(Byte[], Int32, Int32)
Write a block of bytes to the stream
Declaration
public override void Write(byte[] buffer, int offset, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer containing data to write. |
System.Int32 | offset | The offset of the first byte to write. |
System.Int32 | count | The number of bytes to write. |
Overrides
WriteByte(Byte)
Write a byte to the stream.
Declaration
public override void WriteByte(byte value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | The byte to write to the stream. |