Language

Deflater.DeflateAsync Method

Definition

Overloads

Name Description
DeflateAsync(ByteBuffer)

Runs compression into a byte buffer as a task.

DeflateAsync(Byte[])

Runs compression into a byte array as a task.

DeflateAsync(ByteBuffer, Int32)

Runs compression into a byte buffer with the specified flush mode as a task.

DeflateAsync(Byte[], Int32, Int32)

Runs compression into a byte array range as a task.

DeflateAsync(Byte[], Int32, Int32, Int32)

Runs compression into a byte array range with the specified flush mode as a task.

DeflateAsync(ByteBuffer)

Runs compression into a byte buffer as a task.

public System.Threading.Tasks.Task<int> DeflateAsync(Java.Nio.ByteBuffer? output);
member this.DeflateAsync : Java.Nio.ByteBuffer -> System.Threading.Tasks.Task<int>

Parameters

output
ByteBuffer

The writable buffer that receives compressed bytes between its current position and its limit.

Returns

A task whose result is the number of compressed bytes written to output, not the number of input bytes consumed.

Remarks

This .NET wrapper uses Task.Run to call Deflate(ByteBuffer) with NoFlush. It does not use a native asynchronous operation.

The output position advances by the number of bytes written. If input was supplied as a byte buffer, its position advances by the number of bytes consumed. Wait for the task to complete before changing these buffers or using this compressor again.

A result of zero does not by itself mean that compression is complete. Check NeedsInput() and Finished(), and provide output space as needed. Exceptions from the synchronous call are reported through the task.

.NET asynchronous wrapper implementation.

Android compression implementation.

Applies to

DeflateAsync(Byte[])

Runs compression into a byte array as a task.

public System.Threading.Tasks.Task<int> DeflateAsync(byte[]? output);
member this.DeflateAsync : byte[] -> System.Threading.Tasks.Task<int>

Parameters

output
Byte[]

The array that receives compressed bytes, starting at index zero.

Returns

A task whose result is the number of compressed bytes written to output, not the number of input bytes consumed.

Remarks

This .NET wrapper uses Task.Run to call Deflate(Byte[]) with NoFlush. It does not use a native asynchronous operation.

The output capacity is the array length. If input was supplied as a byte buffer, its position advances by the number of bytes consumed. Wait for the task to complete before changing these buffers or using this compressor again.

A result of zero does not by itself mean that compression is complete. Check NeedsInput() and Finished(), and provide output space as needed. Exceptions from the synchronous call are reported through the task.

.NET asynchronous wrapper implementation.

Android compression implementation.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

DeflateAsync(ByteBuffer, Int32)

Runs compression into a byte buffer with the specified flush mode as a task.

public System.Threading.Tasks.Task<int> DeflateAsync(Java.Nio.ByteBuffer? output, int flush);
member this.DeflateAsync : Java.Nio.ByteBuffer * int -> System.Threading.Tasks.Task<int>

Parameters

output
ByteBuffer

The writable buffer that receives compressed bytes between its current position and its limit.

flush
Int32

The flush mode: NoFlush, SyncFlush, or FullFlush.

Returns

A task whose result is the number of compressed bytes written to output, not the number of input bytes consumed.

Remarks

This .NET wrapper uses Task.Run to call Deflate(ByteBuffer, Int32). It does not use a native asynchronous operation.

The output position advances by the number of bytes written. If input was supplied as a byte buffer, its position advances by the number of bytes consumed. Wait for the task to complete before changing these buffers or using this compressor again.

For SyncFlush or FullFlush, if the result equals the output space available before the call, repeat with the same mode and more output space. Provide at least six bytes of output space to avoid repeated flush markers. FullFlush also resets the compression state.

A result of zero does not by itself mean that compression is complete. Check NeedsInput() and Finished() as appropriate. Exceptions from the synchronous call, including an invalid flush mode, are reported through the task.

.NET asynchronous wrapper implementation.

Android compression implementation.

Applies to

DeflateAsync(Byte[], Int32, Int32)

Runs compression into a byte array range as a task.

public System.Threading.Tasks.Task<int> DeflateAsync(byte[]? output, int off, int len);
member this.DeflateAsync : byte[] * int * int -> System.Threading.Tasks.Task<int>

Parameters

output
Byte[]

The array that receives compressed bytes.

off
Int32

The index in output at which to start writing.

len
Int32

The maximum number of compressed bytes to write.

Returns

A task whose result is the number of compressed bytes written to the specified range, not the number of input bytes consumed.

Remarks

This .NET wrapper uses Task.Run to call Deflate(Byte[], Int32, Int32) with NoFlush. It does not use a native asynchronous operation.

If input was supplied as a byte buffer, its position advances by the number of bytes consumed. Wait for the task to complete before changing the input or output buffers or using this compressor again.

A result of zero does not by itself mean that compression is complete. Check NeedsInput() and Finished(), and provide output space as needed. Exceptions from the synchronous call are reported through the task.

.NET asynchronous wrapper implementation.

Android compression implementation.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

DeflateAsync(Byte[], Int32, Int32, Int32)

Runs compression into a byte array range with the specified flush mode as a task.

public System.Threading.Tasks.Task<int> DeflateAsync(byte[]? output, int off, int len, int flush);
member this.DeflateAsync : byte[] * int * int * int -> System.Threading.Tasks.Task<int>

Parameters

output
Byte[]

The array that receives compressed bytes.

off
Int32

The index in output at which to start writing.

len
Int32

The maximum number of compressed bytes to write.

flush
Int32

The flush mode: NoFlush, SyncFlush, or FullFlush.

Returns

A task whose result is the number of compressed bytes written to the specified range, not the number of input bytes consumed.

Remarks

This .NET wrapper uses Task.Run to call Deflate(Byte[], Int32, Int32, Int32). It does not use a native asynchronous operation.

If input was supplied as a byte buffer, its position advances by the number of bytes consumed. Wait for the task to complete before changing the input or output buffers or using this compressor again.

For SyncFlush or FullFlush, if the result equals len, repeat with the same mode and more output space. Use a length greater than six bytes to avoid repeated flush markers. FullFlush also resets the compression state.

A result of zero does not by itself mean that compression is complete. Check NeedsInput() and Finished() as appropriate. Exceptions from the synchronous call, including an invalid flush mode, are reported through the task.

.NET asynchronous wrapper implementation.

Android compression implementation.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to