Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# gzip byte array

static byte[] Compress(byte[] data)
{
  using (var compressedStream = new MemoryStream())
  using (var zipStream = new GZipStream(compressedStream, CompressionMode.Compress))
  {
    zipStream.Write(data, 0, data.Length);
    zipStream.Close();
    return compressedStream.ToArray();
  }
}

static byte[] Decompress(byte[] data)
{
  using (var compressedStream = new MemoryStream(data))
  using (var zipStream = new GZipStream(compressedStream, CompressionMode.Decompress))
  using (var resultStream = new MemoryStream())
  {
    zipStream.CopyTo(resultStream);
    return resultStream.ToArray();
  }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: visual studio c# print to console 
Csharp :: unity check if space pressed 
Csharp :: Unity Make a 2D object look at the mouse position 
Csharp :: c# delete files older than 10 days 
Csharp :: unity how to get y value 
Csharp :: how to set serial number in gridview in asp net 
Csharp :: random number generator unity 
Csharp :: textmeshpro text 
Csharp :: object spin unity 
Csharp :: import C++ into C# 
Csharp :: check connection c# 
Csharp :: unity mirror get ip address 
Csharp :: hex string to int c# 
Csharp :: how to download file from url using c# 
Csharp :: print out a dictionary c# 
Csharp :: unity c# on trigger enter with specific gameobject 
Csharp :: detecting a right click unity 
Csharp :: clear screen putty 
Csharp :: c# or command 
Csharp :: unity set position 
Csharp :: string to enum c# 
Csharp :: dotnet dev-certs https --clean 
Csharp :: get date from file c# 
Csharp :: how to reference text mesh pro unity 
Csharp :: unity empty action 
Csharp :: how to append a new line in a txt file c# 
Csharp :: c# change cursor 
Csharp :: sum of digits in c# 
Csharp :: Considerando um projeto C# e o uso do Entity Framework, após realizar uma alteração em um registro, qual o método que deve ser chamado para salvar as 
Csharp :: convert bytes to string and back c# 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =