墨
墨剑
Unregistered / Unconfirmed
GUEST, unregistred user!
我用TCompressionStream将文件压缩成功,解压的时候用TDeCompressionStream,但读到文件末尾的时候过不去了,如下
var
CryptStream: TDeCompressionStream;
buf: array [0..IBufSize-1] of Byte;
bufferChar;
readCount,sjread,buffsize: integer;
Len: Longword;
begin
inStream.Position := 0;
CryptStream := TDeCompressionStream.Create(inStream);
buffsize :=sizeof(buf);
readCount:=0;
CryptStream.Position :=0;
try
repeat
sjRead := CryptStream.Read(buf,buffsize);//read读前面的时候正常,但当到最后一次读到文件末尾的时候过不去了,CPU一直处在九十左右,出现假死现象.
readCount:=readCount+sjRead;
if sjread > 0 then
OutStream.Write(buf, sjRead);
until (sjRead = 0);
finally
CryptStream.Free;
end;
end;
var
CryptStream: TDeCompressionStream;
buf: array [0..IBufSize-1] of Byte;
bufferChar;
readCount,sjread,buffsize: integer;
Len: Longword;
begin
inStream.Position := 0;
CryptStream := TDeCompressionStream.Create(inStream);
buffsize :=sizeof(buf);
readCount:=0;
CryptStream.Position :=0;
try
repeat
sjRead := CryptStream.Read(buf,buffsize);//read读前面的时候正常,但当到最后一次读到文件末尾的时候过不去了,CPU一直处在九十左右,出现假死现象.
readCount:=readCount+sjRead;
if sjread > 0 then
OutStream.Write(buf, sjRead);
until (sjRead = 0);
finally
CryptStream.Free;
end;
end;