Allow any collection of resources to be downloaded.
This commit is contained in:
@@ -8,8 +8,8 @@ package com.threerings.getdown.net;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.threerings.getdown.data.Resource;
|
import com.threerings.getdown.data.Resource;
|
||||||
@@ -64,7 +64,7 @@ public abstract class Downloader extends Thread
|
|||||||
* the specified observer. The {@link #download} method must be called on the downloader to
|
* the specified observer. The {@link #download} method must be called on the downloader to
|
||||||
* initiate the download process.
|
* initiate the download process.
|
||||||
*/
|
*/
|
||||||
public Downloader (List<Resource> resources, Observer obs)
|
public Downloader (Collection<Resource> resources, Observer obs)
|
||||||
{
|
{
|
||||||
super("Downloader");
|
super("Downloader");
|
||||||
_resources = resources;
|
_resources = resources;
|
||||||
@@ -209,7 +209,7 @@ public abstract class Downloader extends Thread
|
|||||||
throw new DownloadAbortedException();
|
throw new DownloadAbortedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -230,8 +230,8 @@ public abstract class Downloader extends Thread
|
|||||||
*/
|
*/
|
||||||
protected abstract void doDownload (Resource rsrc) throws IOException;
|
protected abstract void doDownload (Resource rsrc) throws IOException;
|
||||||
|
|
||||||
/** The list of resources to be downloaded. */
|
/** The resources to be downloaded. */
|
||||||
protected List<Resource> _resources;
|
protected Collection<Resource> _resources;
|
||||||
|
|
||||||
/** The reported sizes of our resources. */
|
/** The reported sizes of our resources. */
|
||||||
protected Map<Resource, Long> _sizes = new HashMap<Resource, Long>();
|
protected Map<Resource, Long> _sizes = new HashMap<Resource, Long>();
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
|
|
||||||
import com.samskivert.io.StreamUtil;
|
import com.samskivert.io.StreamUtil;
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ import static com.threerings.getdown.Log.log;
|
|||||||
*/
|
*/
|
||||||
public class HTTPDownloader extends Downloader
|
public class HTTPDownloader extends Downloader
|
||||||
{
|
{
|
||||||
public HTTPDownloader (List<Resource> resources, Observer obs)
|
public HTTPDownloader (Collection<Resource> resources, Observer obs)
|
||||||
{
|
{
|
||||||
super(resources, obs);
|
super(resources, obs);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user