|
ms
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Is MemoryStream compressed?Is there a way to determine wether a MemoryStream is compressed, i.e. needs
to be decompressed with GZipStream? bamelyan wrote:
> Is there a way to determine wether a MemoryStream is compressed, i.e. needs Not really.> to be decompressed with GZipStream? Bytes are just bytes. If the first 3 bytes are 0x1f 0x8b 0x08 then there is a decent chance it is gzipped. Arne thanks for quick response. what's the expected behavior of GZipStream if i
try to decompress a stream that is not compressed? Show quoteHide quote "Arne Vajhøj" wrote: > bamelyan wrote: > > Is there a way to determine wether a MemoryStream is compressed, i.e. needs > > to be decompressed with GZipStream? > > Not really. > > Bytes are just bytes. > > If the first 3 bytes are 0x1f 0x8b 0x08 then there is a decent chance > it is gzipped. > > Arne > bamelyan wrote:
> "Arne Vajhøj" wrote: GZipStream if i>> bamelyan wrote: >>> Is there a way to determine wether a MemoryStream is compressed, i.e. needs >>> to be decompressed with GZipStream? >> Not really. >> >> Bytes are just bytes. >> >> If the first 3 bytes are 0x1f 0x8b 0x08 then there is a decent chance >> it is gzipped. > thanks for quick response. what's the expected behavior of > try to decompress a stream that is not compressed? I think one of two will happen:* if the data just happens to be a valid GZIP format then you will get absolute garbage * else (and that is by far the most likely) then you will get a InvalidDataException Arne
Other interesting topics
C# program creating folder on server/access denied
Binary Serialization overhead won't catch my custom exception Filter list with LINQ Problem setting system time... COM control passed to .NET ASCII to hex/binary Get ContentType get current platform (x86, x64) How to sort a ListBox with time format strings |
|||||||||||||||||||||||