Revision 42140 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.compat/org.gvsig.compat.se/src/main/java/org/gvsig/compat/se/net/downloader/se/SEDownloader.java
SEDownloader.java | ||
---|---|---|
205 | 205 |
} |
206 | 206 |
|
207 | 207 |
SEMonitor monitorObj = new SEMonitor(this, cancel); |
208 |
Thread downloader = new Thread(createDownloaderTask(this, url, null, f, cancel.getID())); |
|
208 |
Thread downloader = new Thread(createDownloaderTask(this, url, null, f, cancel.getID().getClass(),-1));
|
|
209 | 209 |
Thread monitor = new Thread(monitorObj); |
210 | 210 |
|
211 | 211 |
monitor.start(); |
... | ... | |
275 | 275 |
* @throws UnknownHostException |
276 | 276 |
*/ |
277 | 277 |
public synchronized File downloadFile(URL url, String data, String name, ICancellable cancel) throws IOException, ConnectException, UnknownHostException { |
278 |
return downloadFile(url, data, name, cancel, -1); |
|
279 |
} |
|
280 |
|
|
281 |
public synchronized File downloadFile(URL url, String data, String name, ICancellable cancel,int maxbytes) throws IOException, ConnectException, UnknownHostException { |
|
278 | 282 |
File f = null; |
279 | 283 |
|
280 | 284 |
if ((f = getPreviousDownloadedURL(url, data)) == null) { |
... | ... | |
297 | 301 |
}; |
298 | 302 |
} |
299 | 303 |
SEMonitor monitorObj = new SEMonitor(this, cancel); |
300 |
Thread downloader = new Thread(createDownloaderTask(this, url, data, f, cancel.getID())); |
|
304 |
Thread downloader = new Thread( |
|
305 |
createDownloaderTask(this, url, data, f, cancel.getID(),maxbytes) |
|
306 |
); |
|
307 |
|
|
301 | 308 |
Thread monitor = new Thread(monitorObj); |
302 | 309 |
monitor.start(); |
303 | 310 |
downloader.start(); |
... | ... | |
449 | 456 |
return this.latency; |
450 | 457 |
} |
451 | 458 |
|
452 |
protected Runnable createDownloaderTask(Downloader downloader, URL url, String data, File target, Object groupID){ |
|
453 |
return new SEDownloaderTask(downloader, url, data, target, groupID); |
|
459 |
protected Runnable createDownloaderTask(Downloader downloader, URL url, String data, File target, Object groupID,int maxbytes){ |
|
460 |
SEDownloaderTask t = new SEDownloaderTask(downloader, url, data, target, groupID); |
|
461 |
t.setMaxbytes(maxbytes); |
|
462 |
return t; |
|
463 |
|
|
454 | 464 |
} |
455 | 465 |
} |
Also available in: Unified diff