Questions tagged [deflatestream]

Microsoft .NET built-in support for standards-compliant Deflate algorithm (compress and decompress).

DeflateStream is a Microsoft .NET Class that provides standards-compliant support for the "DEFLATE" compression algorithm.

78 questions
16
votes
1 answer

zip and unzip string with Deflate

I need to zip and unzip string Here is code: public static byte[] ZipStr(String str) { using (MemoryStream output = new MemoryStream()) using (DeflateStream gzip = new DeflateStream(output, CompressionMode.Compress)) using (StreamWriter…
Mikhail
  • 1,583
  • 5
  • 22
  • 34
9
votes
5 answers

GZipStream and DeflateStream produce bigger files

I'm trying to use deflate/gzip streams in C# but it appears that the files after compression are bigger than before. For example, I compress a docx file of 900ko, but it produce a 1.4Mo one ! And it does it for every file I tried. May be I am wrong…
kite
  • 679
  • 2
  • 8
  • 19
8
votes
1 answer

DeflateStream not decompressing data (the first time)

So here's a strange one. I have this method to take a Base64-encoded deflated string and return the original data: public static string Base64Decompress(string base64data) { byte[] b = Convert.FromBase64String(base64data); using (var orig =…
josh3736
  • 139,160
  • 33
  • 216
  • 263
7
votes
2 answers

Can't compress with mono?

I'm trying to compress some data in mono like this: public static string Save(FlightProgram program, bool compressed) { using (MemoryStream ms = new MemoryStream()) { BinaryFormatter f = new BinaryFormatter(); if…
pixartist
  • 1,137
  • 2
  • 18
  • 40
6
votes
3 answers

Why is my DeflateStream not receiving data correctly over TCP?

I have a TcpClient class on a client and server setup on my local machine. I have been using the Network stream to facilitate communications back and forth between the 2 successfully. Moving forward I am trying to implement compression in the…
Adam Heeg
  • 1,704
  • 1
  • 14
  • 34
6
votes
5 answers

Read Dynamics NAV Table Metadata with SQL

I would like to be able to read the Dynamics NAV 2013 Table Metadata directly from the SQL Server database without requiring the NAV Development Environment. I can view the binary SQL "image" BLOB columns with a query like the following (filter as…
Mister_Tom
  • 1,500
  • 1
  • 23
  • 36
5
votes
2 answers

Raw Stream Has Data, Deflate Returns Zero Bytes

I'm reading data (an adCenter report, as it happens), which is supposed to be zipped. Reading the contents with an ordinary stream, I get a couple thousand bytes of gibberish, so this seems reasonable. So I feed the stream to DeflateStream. First,…
user565869
5
votes
3 answers

C# Custom Serialization/Deserialization together with DeflateStreams

I'm trying to do custom serialization/deserialization of an object as well as compressing/decompressing the serialized data with DeflateStreams. I originally did this for more complex objects but cut it down to try and figure out the problem,…
hillsprig
  • 307
  • 5
  • 12
5
votes
1 answer

Is it possible to use the .NET DeflateStream for pdf creation?

I'm playing around with the ability to create pdf files through C# code. I have been looking at the PDF specifications and have been able to create a working PDF file, done by taking strings of data and encoding them into byte arrays using the UTF8…
myermian
  • 31,823
  • 24
  • 123
  • 215
4
votes
1 answer

HttpClient AutomaticDecompression working with gzip, not deflate

Using both httpbin and Postman Echo (which appear to be the same service, effectively), I'm able to successfully get a gzip'd response with their testing endpoint like this: var cli = new HttpClient(new HttpClientHandler { AutomaticDecompression…
Todd Menier
  • 37,557
  • 17
  • 150
  • 173
4
votes
1 answer

Is it possible to recover corrupted Zlib data beyond the corrupted section?

I have a Zip archive with a large (important) file that will not extract. All Zip utilities that I've tried, including those that claim to recover/fix broken Zip archives are unable to extract the file containing the corrupted zlib compressed data.…
SteveG
  • 317
  • 1
  • 3
  • 7
4
votes
3 answers

"Sync flush" for Zlib Deflate

I need a zlib deflate compressed stream. In my implementation I must use a single stream over the entire session. during this session small chunks of data will be passed through the compressed stream. Everytime a chunk is passed it must be sent in…
hultqvist
  • 17,451
  • 15
  • 64
  • 101
4
votes
2 answers

Zip within a zip opens to undocumented System.IO.Compression.SubReadStream

I have a function I use for aggregating streams from a zip archive. private void ExtractMiscellaneousFiles() { foreach (var miscellaneousFileName in _fileData.MiscellaneousFileNames) { var fileEntry =…
Scotty H
  • 6,432
  • 6
  • 41
  • 94
4
votes
3 answers

Can't inflate with C# using DeflateStream

I'm using mono to inflate/deflate bytes. Here is the code: public static byte[] Inflate(byte[] data) { using (MemoryStream inStream = new MemoryStream(data)) { using (MemoryStream outStream = new MemoryStream()) …
Agas
  • 157
  • 2
  • 7
4
votes
3 answers

Puzzling .Net C# DeflateStream problem

I wonder if anyone can shed some light on an issue that is driving me nuts: I am writing a compression decompression test class. To test it, I am serializing a dataset to a memory stream, compressing it, and uncompressing it and comparing the…
twiga
  • 69
  • 3
  • 7
1
2 3 4 5 6