Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Sub Compress(ByVal infile As String, ByVal outfile As String)
- Dim sourceFile As FileStream = File.OpenRead(inFile)
- Dim destFile As FileStream = File.Create(outfile)
- 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
- sourceFile.Close()
- destFile.Close()
- End Sub
- FileStream sourceFile;
- GZipStream compStream;
- byte[] buffer = new byte[65536];
- int bytesRead = 0;
- while (bytesRead = sourceFile.Read(buffer, 0, 65536) > 0)
- {
- compStream.Write(buffer, 0, bytesRead);
- }
Add Comment
Please, Sign In to add comment