473,396 Members | 1,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

GZipStream compressed file is larger than source file

Hi,

I am using GZipStream to compress a simple text file approx 24MB in
size. I am finding that the destination "compressed" file is several
MB larger than the source file (31MB). The code is as follows:

Dim sourcefile As FileStream = File.OpenRead(inFileName)
Dim destFile As FileStream = File.Open(outFilename,
FileMode.Create, FileAccess.Write)

Dim compStream As New GZipStream(destFile,
CompressionMode.Compress)

Dim myByte As Integer = sourcefile.ReadByte()
While myByte <-1
compStream.WriteByte(CType(myByte, Byte))
myByte = sourcefile.ReadByte()
End While

Any ideas why the compressed file actually ends up larger than the
source?

Thanks,

Matt

Jun 23 '07 #1
1 2086
Note, I have experienced the same result when using other files types,
eg: pdf and doc. I even tried using a DeflateStream instead of
GzipStream, and still the destination files are consistently larger
than the source files...

Jun 23 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Craig Buchanan | last post by:
when i try to open a file that has been compressed with GZipStream (source from microsoft's 101 Samples for Visual Studio 2005), i get an "invalid archive" message from winzip, zipgenius and xp's...
1
by: KJ | last post by:
I am using the System.Compression.GZipStream class, and I noticed that in certain cases, the resultant compressed file is actually larger than the original. This is almost a constant when...
1
by: hakan.thornqvist | last post by:
I am using GZipStream for compression, and the size and contents of the compressed byte array differs from time to time, using the same source. byte uncompressed =...
1
by: sedwick | last post by:
I'm using .NET 2.0.50727 in VS 2005 Pro, ENU Service Pack 1 (KB926601). I've been experimenting with the System.IO.Compression classes GZipStream and DeflateStream, and I found it interesting to...
6
by: =?Utf-8?B?QkRSaWNoYXJkc29u?= | last post by:
Hi, I have been using the new GZipStream classes, and have been experiencing problems when attemping to decompress files, which from experience, seem to be failing when the original file size...
4
by: Arnie | last post by:
Folks, The GZipStream class in .NET is throwing an exception during an OS unseal/power up (first boot experience). The .NET system is fully up as other apps seem to run fine.
2
by: DR | last post by:
Why is its substantialy slower to load 50GB of gzipped file (20GB gzipped file) then loading 50GB unzipped data? im using System.IO.Compression.GZipStream and its not maxing out the cpu while...
5
by: DR | last post by:
Why is its substantialy slower to load 50GB of gzipped file (20GB gzipped file) then loading 50GB unzipped data? im using System.IO.Compression.GZipStream and its not maxing out the cpu while...
11
by: mach77 | last post by:
When using a GZipStream, is there any way to know how many compressed bytes were written? For example: // "buffer" is data from a text file // "offset" is 0 // "count" is 100 ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.