Show / Hide Table of Contents

Class BZip2OutputStream

An output stream that compresses into the BZip2 format including file header chars into another stream.

Inheritance
System.Object
System.MarshalByRefObject
System.IO.Stream
BZip2OutputStream
Implements
System.IDisposable
Inherited Members
System.IO.Stream.Null
System.IO.Stream.BeginRead(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
System.IO.Stream.BeginWrite(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
System.IO.Stream.Close()
System.IO.Stream.CopyTo(System.IO.Stream)
System.IO.Stream.CopyTo(System.IO.Stream, System.Int32)
System.IO.Stream.CopyToAsync(System.IO.Stream)
System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32)
System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.CreateWaitHandle()
System.IO.Stream.Dispose()
System.IO.Stream.EndRead(System.IAsyncResult)
System.IO.Stream.EndWrite(System.IAsyncResult)
System.IO.Stream.FlushAsync()
System.IO.Stream.FlushAsync(System.Threading.CancellationToken)
System.IO.Stream.ObjectInvariant()
System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32)
System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.Synchronized(System.IO.Stream)
System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32)
System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.CanTimeout
System.IO.Stream.ReadTimeout
System.IO.Stream.WriteTimeout
System.MarshalByRefObject.GetLifetimeService()
System.MarshalByRefObject.InitializeLifetimeService()
System.MarshalByRefObject.MemberwiseClone(System.Boolean)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: ICSharpCode.SharpZipLib.BZip2
Assembly: ICSharpCode.SharpZipLib.dll
Syntax
public class BZip2OutputStream : Stream, IDisposable

Constructors

| Improve this Doc View Source

BZip2OutputStream(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.

| Improve this Doc View Source

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 Source

BytesWritten

Get the number of bytes written to the output.

Declaration
public int BytesWritten { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

CanRead

Gets a value indicating whether the current stream supports reading

Declaration
public override bool CanRead { get; }
Property Value
Type Description
System.Boolean
Overrides
System.IO.Stream.CanRead
| Improve this Doc View Source

CanSeek

Gets a value indicating whether the current stream supports seeking

Declaration
public override bool CanSeek { get; }
Property Value
Type Description
System.Boolean
Overrides
System.IO.Stream.CanSeek
| Improve this Doc View Source

CanWrite

Gets a value indicating whether the current stream supports writing

Declaration
public override bool CanWrite { get; }
Property Value
Type Description
System.Boolean
Overrides
System.IO.Stream.CanWrite
| Improve this Doc View Source

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.

| Improve this Doc View Source

Length

Gets the length in bytes of the stream

Declaration
public override long Length { get; }
Property Value
Type Description
System.Int64
Overrides
System.IO.Stream.Length
| Improve this Doc View Source

Position

Gets or sets the current position of this stream.

Declaration
public override long Position { get; set; }
Property Value
Type Description
System.Int64
Overrides
System.IO.Stream.Position

Methods

| Improve this Doc View Source

Dispose(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
System.IO.Stream.Dispose(System.Boolean)
| Improve this Doc View Source

Finalize()

Ensures that resources are freed and other cleanup operations are performed when the garbage collector reclaims the BZip2OutputStream.

Declaration
protected void Finalize()
| Improve this Doc View Source

Flush()

Flush output buffers

Declaration
public override void Flush()
Overrides
System.IO.Stream.Flush()
| Improve this Doc View Source

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
System.IO.Stream.Read(System.Byte[], System.Int32, System.Int32)
| Improve this Doc View Source

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
System.IO.Stream.ReadByte()
| Improve this Doc View Source

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
System.IO.Stream.Seek(System.Int64, System.IO.SeekOrigin)
| Improve this Doc View Source

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
System.IO.Stream.SetLength(System.Int64)
| Improve this Doc View Source

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
System.IO.Stream.Write(System.Byte[], System.Int32, System.Int32)
| Improve this Doc View Source

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.

Overrides
System.IO.Stream.WriteByte(System.Byte)

Implements

System.IDisposable
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2000-2022 SharpZipLib Contributors