用一个函数即实现流的压缩和解压,使用方法:
ZIP(源流,目标流,True/False)TRUE为压缩,FALSE为解压
函数如下:
function ZIP(mInputStream: TStream; mOutputStream: TStream;Compress:BOOL): BOOL;
var
I: Integer;
p:pchar;
TCS:TCompressionStream;
TDS:TDecompressionStream;
begin
result:=false;
if not (Assigned(mInputStream) and Assigned(mOutputStream)) then Exit;
try
if Compress then TCS:=TCompressionStream.Create(clMax,mOutputStream) else TDS:=TDecompressionStream.Create(mOutputStream);//其中的clMax表示压缩级别...[ 查看全文 ]