Method Compress
Compress(byte[])
Compresses the data in the source byte array and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress(byte[] source)
Parameters
source
byte[]The source data to compress.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the source array using the specified compression type. If the source array is empty, an empty MemoryStreamSlim instance is returned.
Compress(byte[], MemoryStreamGZipOptions)
Compresses the data in the source byte array and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress(byte[] source, MemoryStreamGZipOptions compressionOptions)
Parameters
source
byte[]The source data to compress.
compressionOptions
MemoryStreamGZipOptionsThe options that control the compression operation. This can be used to specify the compression type, the compression level, and other options. If null, then default options are used.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the source array using the specified compression type. If the source array is empty, an empty MemoryStreamSlim instance is returned.
Compress(byte[], Func<MemoryStreamGZipOptions, MemoryStreamGZipOptions>)
Compresses the data in the source byte array and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress(byte[] source, Func<MemoryStreamGZipOptions, MemoryStreamGZipOptions> optionsSetup)
Parameters
source
byte[]The source data to compress.
optionsSetup
Func<MemoryStreamGZipOptions, MemoryStreamGZipOptions>Delegate to set up options to configure the compression operation.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the source array using the specified compression type. If the source array is empty, an empty MemoryStreamSlim instance is returned.
Compress<TState>(byte[], Func<MemoryStreamGZipOptions, TState, MemoryStreamGZipOptions>, TState)
Compresses the data in the source byte array and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress<TState>(byte[] source, Func<MemoryStreamGZipOptions, TState, MemoryStreamGZipOptions> optionsSetup, TState setupState)
Parameters
source
byte[]The source data to compress.
optionsSetup
Func<MemoryStreamGZipOptions, TState, MemoryStreamGZipOptions>Delegate to set up options to configure the compression operation.
setupState
TStateState object to pass to the options setup delegate. This can be used to pass any type of state information to the delegate and avoid the need for a closure.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the source array using the specified compression type. If the source array is empty, an empty MemoryStreamSlim instance is returned.
Type Parameters
TState
Compress(in ReadOnlySpan<byte>)
Compresses the data in the source span and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress(in ReadOnlySpan<byte> source)
Parameters
source
ReadOnlySpan<byte>The source data to compress.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the source span using the specified compression type. If the source span is empty, an empty MemoryStreamSlim instance is returned.
Compress(in ReadOnlySpan<byte>, MemoryStreamGZipOptions)
Compresses the data in the source span and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress(in ReadOnlySpan<byte> source, MemoryStreamGZipOptions compressionOptions)
Parameters
source
ReadOnlySpan<byte>The source data to compress.
compressionOptions
MemoryStreamGZipOptionsThe options that control the compression operation. This can be used to specify the compression type, the compression level, and other options. If null, then default options are used.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the source span using the specified compression type. If the source span is empty, an empty MemoryStreamSlim instance is returned.
Compress(in ReadOnlySpan<byte>, Func<MemoryStreamGZipOptions, MemoryStreamGZipOptions>)
Compresses the data in the source span and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress(in ReadOnlySpan<byte> source, Func<MemoryStreamGZipOptions, MemoryStreamGZipOptions> optionsSetup)
Parameters
source
ReadOnlySpan<byte>The source data to compress.
optionsSetup
Func<MemoryStreamGZipOptions, MemoryStreamGZipOptions>Delegate to set up options to configure the compression operation.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the source span using the specified compression type. If the source span is empty, an empty MemoryStreamSlim instance is returned.
Compress<TState>(in ReadOnlySpan<byte>, Func<MemoryStreamGZipOptions, TState, MemoryStreamGZipOptions>, TState)
Compresses the data in the source span and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress<TState>(in ReadOnlySpan<byte> source, Func<MemoryStreamGZipOptions, TState, MemoryStreamGZipOptions> optionsSetup, TState setupState)
Parameters
source
ReadOnlySpan<byte>The source data to compress.
optionsSetup
Func<MemoryStreamGZipOptions, TState, MemoryStreamGZipOptions>Delegate to set up options to configure the compression operation.
setupState
TStateState object to pass to the options setup delegate. This can be used to pass any type of state information to the delegate and avoid the need for a closure.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the span stream using the specified compression type. If the span stream is empty, an empty MemoryStreamSlim instance is returned.
Type Parameters
TState
Compress(string)
Compresses the data in the source string and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress(string source)
Parameters
source
stringThe source data to compress.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the span stream using the specified compression type. If the span stream is empty, an empty MemoryStreamSlim instance is returned.
Compress(string, MemoryStreamGZipOptions)
Compresses the data in the source string and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress(string source, MemoryStreamGZipOptions compressionOptions)
Parameters
source
stringThe source data to compress.
compressionOptions
MemoryStreamGZipOptionsThe options that control the compression operation. This can be used to specify the compression type, the compression level, and other options. If null, then default options are used.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the source string using the specified compression type. If the source string is empty, an empty MemoryStreamSlim instance is returned.
Compress(string, Func<MemoryStreamGZipOptions, MemoryStreamGZipOptions>)
Compresses the data in the source string and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress(string source, Func<MemoryStreamGZipOptions, MemoryStreamGZipOptions> optionsSetup)
Parameters
source
stringThe source data to compress.
optionsSetup
Func<MemoryStreamGZipOptions, MemoryStreamGZipOptions>Delegate to set up options to configure the compression operation.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the source string using the specified compression type. If the source string is empty, an empty MemoryStreamSlim instance is returned.
Compress<TState>(string, Func<MemoryStreamGZipOptions, TState, MemoryStreamGZipOptions>, TState)
Compresses the data in the source string and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress<TState>(string source, Func<MemoryStreamGZipOptions, TState, MemoryStreamGZipOptions> optionsSetup, TState setupState)
Parameters
source
stringThe source data to compress.
optionsSetup
Func<MemoryStreamGZipOptions, TState, MemoryStreamGZipOptions>Delegate to set up options to configure the compression operation.
setupState
TStateState object to pass to the options setup delegate. This can be used to pass any type of state information to the delegate and avoid the need for a closure.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the source string using the specified compression type. If the source string is empty, an empty MemoryStreamSlim instance is returned.
Type Parameters
TState
Compress(string, Encoding)
Compresses the data in the source string with the specified encoding and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress(string source, Encoding encoding)
Parameters
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the source string using the specified compression type. If the source string is empty, an empty MemoryStreamSlim instance is returned.
Compress(string, Encoding, MemoryStreamGZipOptions)
Compresses the data in the source string with the specified encoding and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress(string source, Encoding encoding, MemoryStreamGZipOptions compressionOptions)
Parameters
source
stringThe source data to compress.
encoding
EncodingThe character encoding to use.
compressionOptions
MemoryStreamGZipOptionsThe options that control the compression operation. This can be used to specify the compression type, the compression level, and other options. If null, then default options are used.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the source string using the specified compression type. If the source string is empty, an empty MemoryStreamSlim instance is returned.
Compress(string, Encoding, Func<MemoryStreamGZipOptions, MemoryStreamGZipOptions>)
Compresses the data in the source string with the specified encoding and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress(string source, Encoding encoding, Func<MemoryStreamGZipOptions, MemoryStreamGZipOptions> optionsSetup)
Parameters
source
stringThe source data to compress.
encoding
EncodingThe character encoding to use.
optionsSetup
Func<MemoryStreamGZipOptions, MemoryStreamGZipOptions>Delegate to set up options to configure the compression operation.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the source string using the specified compression type. If the source string is empty, an empty MemoryStreamSlim instance is returned.
Compress<TState>(string, Encoding, Func<MemoryStreamGZipOptions, TState, MemoryStreamGZipOptions>, TState)
Compresses the data in the source string with the specified encoding and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress<TState>(string source, Encoding encoding, Func<MemoryStreamGZipOptions, TState, MemoryStreamGZipOptions> optionsSetup, TState setupState)
Parameters
source
stringThe source data to compress.
encoding
EncodingThe character encoding to use.
optionsSetup
Func<MemoryStreamGZipOptions, TState, MemoryStreamGZipOptions>Delegate to set up options to configure the compression operation.
setupState
TStateState object to pass to the options setup delegate. This can be used to pass any type of state information to the delegate and avoid the need for a closure.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the source string using the specified compression type. If the source string is empty, an empty MemoryStreamSlim instance is returned.
Type Parameters
TState
Compress(Stream)
Compresses the data in the source stream and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress(Stream source)
Parameters
source
StreamThe source stream to compress. This stream must be readable and seekable.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the source stream using the specified compression type. If the source stream is empty, an empty MemoryStreamSlim instance is returned.
Compress(Stream, MemoryStreamGZipOptions)
Compresses the data in the source stream and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress(Stream source, MemoryStreamGZipOptions compressionOptions)
Parameters
source
StreamThe source stream to compress. This stream must be readable and seekable.
compressionOptions
MemoryStreamGZipOptionsThe options that control the compression operation. This can be used to specify the compression type, the compression level, and other options. If null, then default options are used.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the source stream using the specified compression type. If the source stream is empty, an empty MemoryStreamSlim instance is returned.
Compress(Stream, Func<MemoryStreamGZipOptions, MemoryStreamGZipOptions>)
Compresses the data in the source stream and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress(Stream source, Func<MemoryStreamGZipOptions, MemoryStreamGZipOptions> optionsSetup)
Parameters
source
StreamThe source stream to compress. This stream must be readable and seekable.
optionsSetup
Func<MemoryStreamGZipOptions, MemoryStreamGZipOptions>Delegate to set up options to configure the compression operation.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the source stream using the specified compression type. If the source stream is empty, an empty MemoryStreamSlim instance is returned.
Compress<TState>(Stream, Func<MemoryStreamGZipOptions, TState, MemoryStreamGZipOptions>, TState)
Compresses the data in the source stream and returns a new MemoryStreamSlim instance containing the compressed data.
public static MemoryStreamSlim Compress<TState>(Stream source, Func<MemoryStreamGZipOptions, TState, MemoryStreamGZipOptions> optionsSetup, TState setupState)
Parameters
source
StreamThe source stream to compress. This stream must be readable and seekable.
optionsSetup
Func<MemoryStreamGZipOptions, TState, MemoryStreamGZipOptions>Delegate to set up options to configure the compression operation.
setupState
TStateState object to pass to the options setup delegate. This can be used to pass any type of state information to the delegate and avoid the need for a closure.
Returns
- MemoryStreamSlim
A new MemoryStreamSlim instance containing the compressed data from the source stream using the specified compression type. If the source stream is empty, an empty MemoryStreamSlim instance is returned.
Type Parameters
TState