c# GzipStream to decompress the stream only if it is really Packed

0 like 0 dislike
39 views
In General, the question is not obvious at first glance.

What we have:

There is a stream inputStream.
We know that he probably Packed gzip'ohms. Maybe it isn't.

What you need:

You want to read this thread, if necessary after unpacking.
If you just wrap it in GzipStream, it will crash with the error "The magic number in GZip header is not correct".

The catch:

You can't just subtract the stream into a byte [] and then to play with that array, as there are strict limits on the speed.
Does anyone have any suggestions how to do it?
by | 39 views

3 Answers

0 like 0 dislike
Offhand: make thread a wrapper that will check magic continue to skip or not skip using GZipStream.
by
0 like 0 dislike
RFC 1952
by
0 like 0 dislike
Like, the point is that even if the magic match, there is a possibility that inside never gzip.
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
asked May 3, 2019 by WhatIsHTML
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
asked Mar 25, 2019 by Fedcomp
110,608 questions
257,186 answers
0 comments
32,907 users