Class CompressionHelper
A set of helper functions for compressing and decompressing data
Inheritance
Inherited Members
Namespace: LemonEdge.Utils
Assembly: Utils.dll
Syntax
public static class CompressionHelper
  Methods
CompressFile(Byte[])
Compresses raw byte data
Declaration
public static Task<byte[]> CompressFile(byte[] data)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Byte[] | data | The data to compress  | 
      
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<System.Byte[]> | The data compressed  | 
      
CompressFile(FileInfo)
Compresses the contents of a given file and returns the compressed data
Declaration
public static Task<byte[]> CompressFile(FileInfo originalFile)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.IO.FileInfo | originalFile | The file to compress  | 
      
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<System.Byte[]> | The contents of a file compressed  | 
      
CompressFile(Stream)
Compresses the data from a given stream
Declaration
public static Task<byte[]> CompressFile(Stream data)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.IO.Stream | data | The stream to compress  | 
      
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<System.Byte[]> | The compressed data  | 
      
CompressFile(StringBuilder, Encoding)
Compresses the given text using the specified encoding
Declaration
public static Task<byte[]> CompressFile(StringBuilder fileData, Encoding encoding)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Text.StringBuilder | fileData | The text to compress  | 
      
| System.Text.Encoding | encoding | The encoding to use  | 
      
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task<System.Byte[]> | The text compressed  | 
      
CompressFileToStream(Stream, Stream)
Compresses the file stream to a new stream
Declaration
public static Task CompressFileToStream(Stream data, Stream compressTo)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.IO.Stream | data | The data to compress  | 
      
| System.IO.Stream | compressTo | The empty stream to compress the data to  | 
      
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task | A task indicating the completion of the operation  | 
      
DecompressFile(Byte[], FileInfo)
Given some compressed data, this will decompress that data and write it to a specified file on disk
Declaration
public static Task DecompressFile(byte[] compressedData, FileInfo fileInfoToDecompressTo)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Byte[] | compressedData | The compressed data to decompress  | 
      
| System.IO.FileInfo | fileInfoToDecompressTo | The file to compress the data into  | 
      
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task | A task representing the IO operation of writing the decompressed data to disk  | 
      
DecompressFileToStream(Byte[], Stream)
Decompresses the file stream to a new stream
Declaration
public static Task DecompressFileToStream(byte[] data, Stream decompressTo)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Byte[] | data | The data to decompress  | 
      
| System.IO.Stream | decompressTo | 
Returns
| Type | Description | 
|---|---|
| System.Threading.Tasks.Task | A task indicating the completion of the operation  |