这是取自https://forums.embarcadero.com/message.jspa?messageID=219481的代码片段
if FileExists(dstFile) then
begin
Fs := TFileStream.Create(dstFile, fmOpenReadWrite);
try
Fs.Seek(Max(0, Fs.Size-1024), soFromBeginning);
// alternatively:
// Fs.Seek(-1024, soFromEnd);
Http.Request.Range := IntToStr(Fs.Position) + '-';
Http.Get(Url, Fs);
finally
Fs.Free;
end;
end;
我不明白究竟是什么偏移以及为什么 Max(0,Fs.Size-1024) 在它的占位符中,如果你去下面(在代码中)
// alternatively:
// Fs.Seek(-1024, soFromEnd);
'-1024'到底是什么......为什么总是使用1024 / -1024?并且 fs.size 会单独在偏移领跑者工作中(我正在尝试使用暂停恢复支持进行下载管理)并且在上面的代码中用 tmemmorystream 替换 tfilestream 会对程序产生任何影响吗?
如果重要:我使用 d2007 和 d2010