Class FastLZStream

Class FastLZStream

Namespace: Aspose.Zip.FastLZ
Assembly: Aspose.Zip.dll (25.2.0)

A stream wrapper that compresses data with FastLZ. Implements decorator pattern.

public class FastLZStream : Stream, IDisposable, IAsyncDisposable

Inheritance

objectMarshalByRefObjectStreamFastLZStream

Implements

IDisposable, IAsyncDisposable

Inherited Members

Stream.Null, Stream.CopyTo(Stream), Stream.CopyTo(Stream, int), Stream.CopyToAsync(Stream), Stream.CopyToAsync(Stream, int), Stream.CopyToAsync(Stream, CancellationToken), Stream.CopyToAsync(Stream, int, CancellationToken), Stream.Dispose(), Stream.Close(), Stream.Dispose(bool), Stream.DisposeAsync(), Stream.Flush(), Stream.FlushAsync(), Stream.FlushAsync(CancellationToken), Stream.CreateWaitHandle(), Stream.BeginRead(byte[], int, int, AsyncCallback?, object?), Stream.EndRead(IAsyncResult), Stream.ReadAsync(byte[], int, int), Stream.ReadAsync(byte[], int, int, CancellationToken), Stream.ReadAsync(Memory<byte>, CancellationToken), Stream.ReadExactlyAsync(Memory<byte>, CancellationToken), Stream.ReadExactlyAsync(byte[], int, int, CancellationToken), Stream.ReadAtLeastAsync(Memory<byte>, int, bool, CancellationToken), Stream.BeginWrite(byte[], int, int, AsyncCallback?, object?), Stream.EndWrite(IAsyncResult), Stream.WriteAsync(byte[], int, int), Stream.WriteAsync(byte[], int, int, CancellationToken), Stream.WriteAsync(ReadOnlyMemory<byte>, CancellationToken), Stream.Seek(long, SeekOrigin), Stream.SetLength(long), Stream.Read(byte[], int, int), Stream.Read(Span<byte>), Stream.ReadByte(), Stream.ReadExactly(Span<byte>), Stream.ReadExactly(byte[], int, int), Stream.ReadAtLeast(Span<byte>, int, bool), Stream.Write(byte[], int, int), Stream.Write(ReadOnlySpan<byte>), Stream.WriteByte(byte), Stream.Synchronized(Stream), Stream.ObjectInvariant(), Stream.ValidateBufferArguments(byte[], int, int), Stream.ValidateCopyToArguments(Stream, int), Stream.CanRead, Stream.CanWrite, Stream.CanSeek, Stream.CanTimeout, Stream.Length, Stream.Position, Stream.ReadTimeout, Stream.WriteTimeout, MarshalByRefObject.GetLifetimeService(), MarshalByRefObject.InitializeLifetimeService(), MarshalByRefObject.MemberwiseClone(bool), object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

FastLZStream(Stream, int)

Initializes a new instance of the Aspose.Zip.FastLZ.FastLZStream class prepared for compression.

public FastLZStream(Stream stream, int compressionLevel)

Parameters

stream Stream

The stream for saving compressed data.

compressionLevel int

Use 1 for faster compression, use 2 for better compression ratio.

Exceptions

ArgumentNullException

stream is null.

ArgumentException

stream does not support writing.

ArgumentOutOfRangeException

compressionLevel is more than 2 or less than 1.

Properties

CanRead

Gets a value indicating whether the current stream supports reading.

public override bool CanRead { get; }

Property Value

bool

CanSeek

Gets a value indicating whether the current stream supports seeking.

public override bool CanSeek { get; }

Property Value

bool

CanWrite

Gets a value indicating whether the current stream supports writing.

public override bool CanWrite { get; }

Property Value

bool

Length

Gets the length in bytes of the stream.

public override long Length { get; }

Property Value

long

Position

Gets or sets the position within the current stream.

public override long Position { get; set; }

Property Value

long

Methods

Close()

Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream.

public override void Close()

Flush()

Clears all buffers for this stream and causes any buffered data to be written to the underlying device.

public override void Flush()

Read(byte[], int, int)

Reads a sequence of bytes from the stream and advances the position within the stream by the number of bytes read. Not supported.

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

Parameters

buffer byte[]

An array of bytes. When this method returns, the buffer contains the specified byte array with the values between offset and (offset + count - 1) replaced by the bytes read from the current source.

offset int

The zero-based byte offset in buffer at which to begin storing the data read from the current stream.

count int

The maximum number of bytes to be read from the current stream.

Returns

int

The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.

Seek(long, SeekOrigin)

Sets the position within the current stream.

public override long Seek(long offset, SeekOrigin origin)

Parameters

offset long

A byte offset relative to the origin parameter.

origin SeekOrigin

A value of type SeekOrigin indicating the reference point used to obtain the new position.

Returns

long

The new position within the current stream.

SetLength(long)

Sets the length of the current stream.

public override void SetLength(long value)

Parameters

value long

The desired length of the current stream in bytes.

Write(byte[], int, int)

Writes a sequence of bytes to the compressing 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. </byte></byte></byte></byte></byte></byte></byte></byte>

 English