Class GZip
This class provides functionality for compressing and decompressing strings and raw byte[] arrays using the System.IO.Compression.GZipStream.
Inheritance
Inherited Members
Namespace: GlitchedPolygons.Utilities
Assembly: UnityScriptsLibrary.dll
Syntax
public static class GZip
Methods
| Improve this Doc View SourceCompress(Byte[], Int32, CompressionLevel)
Compresses the specified bytes using System.IO.Compression.GZipStream.
Declaration
public static byte[] Compress(byte[] bytes, int bufferSize = 4096, CompressionLevel compressionLevel = CompressionLevel.Fastest)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | bytes | The |
| System.Int32 | bufferSize | The size of the underlying stream buffer. Try to give a rough estimate of how many bytes you'll need... |
| System.IO.Compression.CompressionLevel | compressionLevel | Choose the desired System.IO.Compression.CompressionLevel. The default value favors speed over efficiency (System.IO.Compression.CompressionLevel.Fastest). |
Returns
| Type | Description |
|---|---|
| System.Byte[] | The compressed |
Compress(String)
Compresses the specified string with the System.IO.Compression.GZipStream and the GlitchedPolygons.Utilities.GZip.DEFAULT_ENCODING.
Declaration
public static string Compress(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The string to compress. |
Returns
| Type | Description |
|---|---|
| System.String | The compressed (gzipped) string. |
Compress(String, Encoding)
Compresses the specified string with System.IO.Compression.GZipStream using a specific System.Text.Encoding.
Declaration
public static string Compress(string text, Encoding encoding)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | String to compress. |
| System.Text.Encoding | encoding | Encoding. |
Returns
| Type | Description |
|---|---|
| System.String | The compressed string. |
Decompress(Byte[], Int32)
Decompresses the specified bytes.
Declaration
public static byte[] Decompress(byte[] gzippedBytes, int bufferSize = 4096)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | gzippedBytes | The gzipped bytes to decompress. |
| System.Int32 | bufferSize | The size of the underlying stream buffer. Try to give a rough estimate of how many bytes you'll need... |
Returns
| Type | Description |
|---|---|
| System.Byte[] | The decompressed bytes. |
Decompress(String)
Decompresses the specified gzipped string using the GlitchedPolygons.Utilities.GZip.DEFAULT_ENCODING.
Declaration
public static string Decompress(string gzippedString)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | gzippedString | The gzipped string to decompress. |
Returns
| Type | Description |
|---|---|
| System.String | The decompressed string. |
Decompress(String, Encoding)
Decompresses the specified gzipped string using a specific System.Text.Encoding.
Declaration
public static string Decompress(string gzippedString, Encoding encoding)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | gzippedString | The gzipped string to decompress. |
| System.Text.Encoding | encoding | Encoding. |
Returns
| Type | Description |
|---|---|
| System.String | The decompressed string. |