03/03/09 19:13
klez91
Ciao a tutti...mi servirebbe comprimere un array di bytes e salvare il risultato in un'altro array. Questo ovviamente nn è possibile farlo a primo impatto cn il DeflateStream o il GzipStream perchè essi lavorano solo sugli stream, mentre a me mi servirebbe salvare il contenuto in un array. Ho abbozzato un po di codice per la compressione funziona però quando vado a decomprimere l'array di output è uguale a 0...
Spero di essere stato chiaro...grazie per un'eventuale aiuto
Private Function GZipCompressBytes(ByVal Input() As Byte) As Byte() Dim Stream As New IO.MemoryStream Dim GZip As New IO.Compression.GZipStream(Stream, IO.Compression.CompressionMode.Compress) GZip.Write(Input, 0, Input.Length) Stream.Seek(0, IO.SeekOrigin.Begin) Dim Output(Stream.Length - 1) As Byte Stream.Read(Output, 0, Output.Length) GZip.Close() Stream.Close() Return Output End Function
Private Function GZipDecompressBytes(ByVal Input() As Byte) As Byte() Dim Stream As New IO.MemoryStream Stream.Write(Input, 0, Input.Length) Dim GZip As New IO.Compression.GZipStream(Stream, IO.Compression.CompressionMode.Decompress) Stream.Seek(0, IO.SeekOrigin.Begin) Dim Output(Stream.Length - 1) As Byte GZip.Read(Output, 0, Output.Length) GZip.Close() Stream.Close() Return Output End Function
Spero di essere stato chiaro...grazie per un'eventuale aiuto
Ultima modifica effettuata da klez91 05/03/09 16:29
aaa