Compressor Compressor Compressor Compressor Class

Definition

A compressor takes information written to a stream and compresses it using a compression algorithm.

public sealed class Compressorpublic sealed class CompressorPublic NotInheritable Class Compressorpublic sealed class Compressor
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Constructors

Compressor(IOutputStream) Compressor(IOutputStream) Compressor(IOutputStream) Compressor(IOutputStream)

Creates an instance of a compressor.

public Compressor(IOutputStream underlyingStream)public New(IOutputStream underlyingStream)Public Sub New(underlyingStream As IOutputStream)public Compressor(IOutputStream underlyingStream)
Parameters
underlyingStream
IOutputStream IOutputStream IOutputStream IOutputStream

The stream of compressed information to be written by the compressor.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Compressor(IOutputStream, CompressAlgorithm, UInt32) Compressor(IOutputStream, CompressAlgorithm, UInt32) Compressor(IOutputStream, CompressAlgorithm, UInt32) Compressor(IOutputStream, CompressAlgorithm, UInt32)

Creates an instance of a compressor.

public Compressor(IOutputStream underlyingStream, CompressAlgorithm algorithm, UInt32 blockSize)public New(IOutputStream underlyingStream, CompressAlgorithm algorithm, UInt32 blockSize)Public Sub New(underlyingStream As IOutputStream, algorithm As CompressAlgorithm, blockSize As UInt32)public Compressor(IOutputStream underlyingStream, CompressAlgorithm algorithm, UInt32 blockSize)
Parameters
underlyingStream
IOutputStream IOutputStream IOutputStream IOutputStream

The stream of compressed information to be written by the compressor.

algorithm
CompressAlgorithm CompressAlgorithm CompressAlgorithm CompressAlgorithm

The compression algorithm used by the compressor to write underlyingStream.

blockSize
System.UInt32 System.UInt32 System.UInt32 System.UInt32

Size in bytes of the intermediate buffer used by the compression algorithm. A value of 0 specifies that the compression algorithm will use its default block size. Valid non-zero values for this parameter are 32Kb to 64Mb.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Methods

Close() Close() Close() Close()

Closes a Compressor object and synchronously discards any information in buffers. This will close the underlying stream as well unless the DetachStream() method has been used to detach the stream from the object. Subsequent calls on a closed object, except for , will fail.

public void Close()public void Close()Public Function Close() As voidpublic void Close()
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

DetachStream() DetachStream() DetachStream() DetachStream()

Detaches the underlying stream from the Compressor object so that the object can be closed using the Close() method without also closing the underlying stream.

public IOutputStream DetachStream()public IOutputStream DetachStream()Public Function DetachStream() As IOutputStreampublic IOutputStream DetachStream()
Returns
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

FinishAsync() FinishAsync() FinishAsync() FinishAsync()

Finishes writing the compression stream.

public IAsyncOperation<bool> FinishAsync()public IAsyncOperation<bool> FinishAsync()Public Function FinishAsync() As IAsyncOperation( Of bool )public IAsyncOperation<bool> FinishAsync()
Returns

The asynchronous operation.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

FlushAsync() FlushAsync() FlushAsync() FlushAsync()

Flushes the compression stream asynchronously.

public IAsyncOperation<bool> FlushAsync()public IAsyncOperation<bool> FlushAsync()Public Function FlushAsync() As IAsyncOperation( Of bool )public IAsyncOperation<bool> FlushAsync()
Returns

The asynchronous operation.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

WriteAsync(IBuffer) WriteAsync(IBuffer) WriteAsync(IBuffer) WriteAsync(IBuffer)

Writes information to the compression stream asynchronously.

public IAsyncOperationWithProgress<uint, uint> WriteAsync(IBuffer buffer)public IAsyncOperationWithProgress<uint, uint> WriteAsync(IBuffer buffer)Public Function WriteAsync(buffer As IBuffer) As IAsyncOperationWithProgress( Of uint, uint )public IAsyncOperationWithProgress<uint, uint> WriteAsync(IBuffer buffer)
Parameters
buffer
IBuffer IBuffer IBuffer IBuffer

The buffer that contains the information to be written to the stream.

Returns

The asynchronous operation.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)