我想使用NuGet https://www.nuget.org/packages/lz4net/提供的lz4net库解压缩LZ4编码的字符串,该库的GitHub站点为https://github.com/MiloszKrajewski/lz4net。
我不熟悉溪流或这个库,但到目前为止我的代码是:
Private Function LZ4Decompress(input As String) As String
Dim inputBytes() As Byte = System.Text.Encoding.Unicode.GetBytes(input)
Dim inputStream As New MemoryStream()
inputStream.Write(inputBytes, 0, inputBytes.Length)
inputStream.Seek(0, SeekOrigin.Begin)
Dim outputStream As New MemoryStream()
Dim outputBytes(1024) As Byte
Dim output As String
Using lzStream As New LZ4.LZ4Stream(inputStream, LZ4.LZ4StreamMode.Decompress)
' how to write to outputStream ?
End Using
outputStream.Read(outputBytes, 0, outputStream.Length)
output = System.Text.Encoding.Unicode.GetString(outputBytes)
Return output
End Function
的问题: