Compressor Compressor Compressor Compressor Class

Definition

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

public : sealed class Compressor : IClosable, ICompressor, IOutputStream
public sealed class Compressor : IDisposable, ICompressor, IOutputStream
Public NotInheritable Class Compressor Implements IDisposable, ICompressor, IOutputStream
var compressor = new compressor(underlyingStream);
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 Compressor(IOutputStream underlyingStream)
Public Sub New(underlyingStream As IOutputStream)
var compressor = new compressor(underlyingStream);
Parameters
underlyingStream
IOutputStream IOutputStream IOutputStream IOutputStream

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

See Also

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, unsigned int blockSize)
public Compressor(IOutputStream underlyingStream, CompressAlgorithm algorithm, UInt32 blockSize)
Public Sub New(underlyingStream As IOutputStream, algorithm As CompressAlgorithm, blockSize As UInt32)
var compressor = new compressor(underlyingStream, algorithm, 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
unsigned int UInt32 UInt32 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.

See Also

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 Compressor.Detach method has been used to detach the stream from the object. Subsequent calls on a closed object, except for , will fail.

public : void Close()
This member is not implemented in C#
This member is not implemented in VB.Net
compressor.close();

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

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

public : IOutputStream DetachStream()
public IOutputStream DetachStream()
Public Function DetachStream() As IOutputStream
var iOutputStream = compressor.detachStream();
Returns

Dispose() Dispose() Dispose() Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

This member is not implemented in C++
void Dispose()
Sub Dispose
void Dispose()

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

Finishes writing the compression stream.

public : IAsyncOperation<Platform::Boolean> FinishAsync()
public IAsyncOperation<bool> FinishAsync()
Public Function FinishAsync() As IAsyncOperation( Of bool )
Windows.Storage.Compression.Compressor.finishAsync().done( /* Your success and error handlers */ );
Returns

The asynchronous operation.

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

Flushes the compression stream asynchronously.

public : IAsyncOperation<Platform::Boolean> FlushAsync()
public IAsyncOperation<bool> FlushAsync()
Public Function FlushAsync() As IAsyncOperation( Of bool )
Windows.Storage.Compression.Compressor.flushAsync().done( /* Your success and error handlers */ );
Returns

The asynchronous operation.

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

Writes information to the compression stream asynchronously.

public : IAsyncOperationWithProgress<unsigned int, unsigned int> WriteAsync(IBuffer buffer)
public IAsyncOperationWithProgress<uint, uint> WriteAsync(IBuffer buffer)
Public Function WriteAsync(buffer As IBuffer) As IAsyncOperationWithProgress( Of uint )( Of uint )
Windows.Storage.Compression.Compressor.writeAsync(buffer).done( /* Your success and error handlers */ );
Parameters
buffer
IBuffer IBuffer IBuffer IBuffer

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

Returns

The asynchronous operation.

See Also