C
Carly
Hello,
I am just wondering if somebody can look on this piece of code and let
me know what is wrong with DECOMPRESSION.
Dim mystr As String = "flower power"
'deflate
Dim mybytearray() As Byte
Dim mybytearraytarget() As Byte
mybytearray = Encoding.Default.GetBytes(mystr)
Dim mystream As New MemoryStream
Dim mystreami As New MemoryStream
Dim objdeflate As New DeflateStream(mystream,
CompressionMode.Compress)
objdeflate.Write(mybytearray, 0, mybytearray.Length)
mybytearraytarget = mystream.ToArray
mystream.Close()
'decompress
Dim objinflate As New DeflateStream(mystreami,
CompressionMode.Decompress)
objinflate.Read(mybytearraytarget, 0, mybytearraytarget.Length)
'at this poing mystreami is empty. I am wondering why?
Dim sr As New StreamReader(mystreami)
MsgBox(sr.ReadToEnd)
I wonder also if anybody can share a compress/decompress code segment
(in VB) different from the one MS has on their online help.
Thank you,
Carly
I am just wondering if somebody can look on this piece of code and let
me know what is wrong with DECOMPRESSION.
Dim mystr As String = "flower power"
'deflate
Dim mybytearray() As Byte
Dim mybytearraytarget() As Byte
mybytearray = Encoding.Default.GetBytes(mystr)
Dim mystream As New MemoryStream
Dim mystreami As New MemoryStream
Dim objdeflate As New DeflateStream(mystream,
CompressionMode.Compress)
objdeflate.Write(mybytearray, 0, mybytearray.Length)
mybytearraytarget = mystream.ToArray
mystream.Close()
'decompress
Dim objinflate As New DeflateStream(mystreami,
CompressionMode.Decompress)
objinflate.Read(mybytearraytarget, 0, mybytearraytarget.Length)
'at this poing mystreami is empty. I am wondering why?
Dim sr As New StreamReader(mystreami)
MsgBox(sr.ReadToEnd)
I wonder also if anybody can share a compress/decompress code segment
(in VB) different from the one MS has on their online help.
Thank you,
Carly