Hi Peter Volz,
Here is a snippet for you to check if it solves your problem.
using (var myGZipStream = new Compression.GZipStream(MyImportStream, Compression.CompressionMode.Decompress))
{
try
{
byte[] _buffer = new byte[4096]; //Here, we read decompressed data, but don't write it to an output stream
while (myGZipStream.Read(_buffer, 0, _buffer.Length) > 0) {}
return true; //If it gets this far, your Gzip is valid.
}
catch (Exception)
{
return false; //If an exception occurs, it indicates that your Gzip is invalid
}
}
Using myGZipStream As New GZipStream(MyImportStream, Compression.CompressionMode.Decompress)
Try
Dim buffer As Byte() = New Byte(4096) {} 'Here, we read decompressed data, but don't write it to an output stream
While myGZipStream.Read(buffer, 0, buffer.Length) > 0
End While
Return True 'If it gets this far, your Gzip is valid.
Catch
Return False 'If an exception occurs, it indicates that your Gzip is invalid
End Try
End Using
Regards,