有用7z.DLL, SevenZipSharp.dll 流压缩出错.

华芸智森 2014-07-06 12:08:20
    Public Function Compress7z(indata() As Byte) As Byte()
Dim compressed As Byte() = Nothing
Dim compressor As SevenZipCompressor = New SevenZipCompressor()
compressor.CompressionMethod = CompressionMethod.Default
compressor.CompressionLevel = CompressionLevel.Normal

Using msin As MemoryStream = New MemoryStream(indata)
msin.Position = 0
Using msout As MemoryStream = New MemoryStream()
compressor.CompressStream(msin, msout) '//“System.NullReferenceException”类型的未经处理的异常在 SevenZipSharp.dll 中发生 其他信息: 未将对象引用设置到对象的实例。
msout.Position = 0
ReDim compressed(CInt(msout.Length))
msout.Read(compressed, 0, compressed.Length)
End Using
End Using

Return compressed

End Function
...全文
274 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
华芸智森 2014-07-06
  • 打赏
  • 举报
回复
没有对象是空的.
落叶1210 2014-07-06
  • 打赏
  • 举报
回复
compressor.CompressStream(msin, msout) 是不是有对象 为 null??
华芸智森 2014-07-06
  • 打赏
  • 举报
回复
搞定,将7Z的源代码重编译一次就好了.估计是跟编译有关.

16,722

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧