BrotliEncoder.TryCompress Method

Definition

Overloads

TryCompress(ReadOnlySpan<Byte>, Span<Byte>, Int32)

Tries to compress a source byte span into a destination span.

TryCompress(ReadOnlySpan<Byte>, Span<Byte>, Int32, Int32, Int32)

Tries to compress a source byte span into a destination byte span, using the provided compression quality leven and encoder window bits.

TryCompress(ReadOnlySpan<Byte>, Span<Byte>, Int32)

Tries to compress a source byte span into a destination span.

public:
 static bool TryCompress(ReadOnlySpan<System::Byte> source, Span<System::Byte> destination, [Runtime::InteropServices::Out] int % bytesWritten);
public static bool TryCompress (ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten);
static member TryCompress : ReadOnlySpan<byte> * Span<byte> * int -> bool
Public Shared Function TryCompress (source As ReadOnlySpan(Of Byte), destination As Span(Of Byte), ByRef bytesWritten As Integer) As Boolean

Parameters

source
ReadOnlySpan<Byte>

A read-only span of bytes containing the source data to compress.

destination
Span<Byte>

When this method returns, a span of bytes where the compressed data is stored.

bytesWritten
Int32

When this method returns, the total number of bytes that were written to destination.

Returns

true if the compression operation was successful; false otherwise.

Applies to

TryCompress(ReadOnlySpan<Byte>, Span<Byte>, Int32, Int32, Int32)

Tries to compress a source byte span into a destination byte span, using the provided compression quality leven and encoder window bits.

public:
 static bool TryCompress(ReadOnlySpan<System::Byte> source, Span<System::Byte> destination, [Runtime::InteropServices::Out] int % bytesWritten, int quality, int window);
public static bool TryCompress (ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten, int quality, int window);
static member TryCompress : ReadOnlySpan<byte> * Span<byte> * int * int * int -> bool
Public Shared Function TryCompress (source As ReadOnlySpan(Of Byte), destination As Span(Of Byte), ByRef bytesWritten As Integer, quality As Integer, window As Integer) As Boolean

Parameters

source
ReadOnlySpan<Byte>

A read-only span of bytes containing the source data to compress.

destination
Span<Byte>

When this method returns, a span of bytes where the compressed data is stored.

bytesWritten
Int32

When this method returns, the total number of bytes that were written to destination.

quality
Int32

A number representing quality of the Brotli compression. 0 is the minimum (no compression), 11 is the maximum.

window
Int32

A number representing the encoder window bits. The minimum value is 10, and the maximum value is 24.

Returns

true if the compression operation was successful; false otherwise.

Applies to