Show / Hide Table of Contents

Class GZip

This class provides functionality for compressing and decompressing strings and raw byte[] arrays using the System.IO.Compression.GZipStream.

Inheritance
System.Object
GZip
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: GlitchedPolygons.Utilities
Assembly: UnityScriptsLibrary.dll
Syntax
public static class GZip

Methods

| Improve this Doc View Source

Compress(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 byte[] array to compress.

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 byte[] array.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX