protected long getContentLength() {
return _length;
}
protected void writeTo(OutputStream o) throws IOException {
MD5OutputStream out = new MD5OutputStream(o);
out.write(_initialSniffBytes);
int startBlock = (int) (_rangeStart / Store.DATA_BLOCK_SIZE);
int endBlock = (int) (_rangeEnd / Store.DATA_BLOCK_SIZE);
OutputStream tos = new TruncatingOutputStream(out,
DownloadHandler.INITIAL_SNIFF_BYTES
+ (_rangeStart % Store.DATA_BLOCK_SIZE),
(_rangeEnd - _rangeStart) + 1
- DownloadHandler.INITIAL_SNIFF_BYTES);
Download dl = new Download(_reqUrl, _length, _lastModified, startBlock,
endBlock, tos);
long startTime = System.currentTimeMillis();
dl.start();
long totalTime = System.currentTimeMillis() - startTime;
String actualMD5 = out.getMD5Sum();
String correctMD5 = downloadMd5();
synchronized (recentDownloads) {
while (recentDownloads.size() >= MAX_RECENT_DOWNLOADS) {
recentDownloads.removeLast();
}