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
1
vote
1 answer

Efficient way to store the DeflateStream result to `byte[]`?

I am reading the varbinary(MAX) from the SQL server table into the byte[] content variable. Then the DeflateStream is used to unpack the content. The final goal is to assign the unpacked content to another byte[] array, and then store it into the…
pepr
  • 20,112
  • 15
  • 76
  • 139
1
vote
0 answers

DeflateStream repeats bytes when decompressing data

I have encountered a problem with DeflateStream -- some of the data is being written repeatedly, to the end. Here is the code: Dim bytesin As Byte() = ... ' An array of compressed bytes Dim bytesout As Byte() Dim count As Integer Using ms As New…
Velcro
  • 546
  • 1
  • 8
  • 27
1
vote
0 answers

Any way to replicate the .Net Core DeflateStream.Flush() behaviour in .Net Framework?

Background I want to use StreamJsonRpc as a replacement for WCF in a future .Net Core port of an application. Before porting the code to .Net Core, I want to update the existing code (which is .Net Framework 4.8) to use StreamJsonRpc. Because the…
Matthew Watson
  • 104,400
  • 10
  • 158
  • 276
1
vote
1 answer

Decompress SQL Blob Content and return the answer in PushStreamContent .NET Core

I am developing a new API in a .NET Core service, the new API is supposed to read a BLOB from SQL table, decompress it using DeflateStream. And then return it (stream it) to the client. In order not to consume much memory. I am returning a response…
user3299116
  • 43
  • 1
  • 7
1
vote
0 answers

How to upload a DB backup to a FTP server

On the tail end of database backup project and I've run into a issue where the Deflate compression I put in can't seem to find the path I saved the backup to. Being that the default backup location (used here) is on a network drive is there…
Red Rabbit
  • 115
  • 1
  • 11
1
vote
1 answer

C# DeflateStream.Read() giving an InvalidDataException

I want to unzip a compressed string so that the string of characters would become usable. I successfully extract in an array of bytes the content of a downloaded file with the function WebClient.DownloadData(String). The characters are logically…
Gaël
  • 117
  • 1
  • 2
  • 17
1
vote
0 answers

.NET Deflate Stream Error/Bug

Has anyone experienced the following error while using the .NET Deflate Stream? System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.IO.Compression.HuffmanTree.CreateTable() at…
user113476
1
vote
0 answers

Decompress a stream of bytes using deflatestream

I have a server and a client connecting using TCP socket. At the client (which is written in C++) I compress a string (str) using the zlib library: uLongf compressedStringLength = compressBound(str.length()); Bytef* compressedString = new…
user382704
  • 19
  • 4
1
vote
2 answers

DeflateStream advancing underlying stream to end

I'm trying to read out git objects from a git pack file, following the format for pack files laid out here. Once I hit the compressed data I'm running into issues. I'm trying to use System.IO.Compression.DeflateStream to decompress the zlib…
ameer
  • 2,598
  • 2
  • 21
  • 36
1
vote
2 answers

how to both Compress and Minify content together?

i know we can compress response by declaring Response.Filter as GZip or Delfalte streams, but how i can perform both compression and minification together? declaring new class that inherits Stream, then first performing minify on content, then…
Sadegh
  • 4,181
  • 9
  • 45
  • 78
1
vote
1 answer

DeflateStream.ReadAsync (.NET 4.5 System.IO.Compression) has different return value of bytes read than equivalent Read method?

While converting some older code to use async in c#, I started seeing problems in variations of return values from the Read() and ReadAsync() methods of the DeflateStream. I thought that the transition from synchronous code like bytesRead =…
NightCoder
  • 55
  • 1
  • 4
1
vote
1 answer

How does DeFlateStream.read redirect to System.Net.ConnectStream.Read?

In the process of debugging a code and it appears to me that DeFlateStream.read redirects to System.Net.ConnectStream.Read? When I check MSDN source code I couldn't easily find this redirection. Anyone could help me find how this occurs? thanks!
Jason
  • 821
  • 2
  • 16
  • 28
1
vote
1 answer

Get all uncompressed bytes from a compressed file

I've created a method for returning all the uncompressed bytes from a compressed file. public static byte[] GetAllBytesFromCompressedFile(string fullPath) { const int blockSize = 10000; byte[] block = new byte[blockSize]; …
Arve Hansen
  • 1,008
  • 11
  • 16
1
vote
1 answer

Do an HTTP Post in .NET (Vb) with compressed data using deflatestream

The data that I am posting from a VB.Net client is large and I want to compress. I want to do a "POST" and the apache server supports mod_deflate. I am trying to integrate DeflateStream into my post code, however does not seem to be working. I can…
Brian
  • 433
  • 1
  • 7
  • 16
1
vote
1 answer

Decompress bytes using DeflateStream

I'm trying to decompress a byte array. Because I want to extract a .png file from a zip. I tried this: var compressedData = ZlibStream.UncompressBuffer(cByteArray); var uncompressedData = ZlibStream.CompressBuffer(compressedData); …
user2911090
  • 15
  • 1
  • 7