properly javadoc things, include proguard/lib modifications
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
-injars lib/jRegistryKey.jar(!META-INF/*)
|
||||
-injars lib/samskivert.jar(!META-INF/*,!**/velocity/**,!**/xml/**)
|
||||
-injars lib/commons-io.jar(!META-INF/*)
|
||||
-injars lib/snark.jar(!META-INF/*)
|
||||
|
||||
-libraryjars <java.home>/lib/rt.jar
|
||||
-dontskipnonpubliclibraryclasses
|
||||
|
||||
@@ -141,6 +141,9 @@ public abstract class Downloader extends Thread
|
||||
_totalSize += checkSize(rsrc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the protocol-specific portion of checking download size.
|
||||
*/
|
||||
protected abstract long checkSize (Resource rsrc) throws IOException;
|
||||
|
||||
/**
|
||||
@@ -162,6 +165,10 @@ public abstract class Downloader extends Thread
|
||||
doDownload(rsrc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Periodically called by the protocol-specific downloaders
|
||||
* to update their progress.
|
||||
*/
|
||||
protected void updateObserver ()
|
||||
{
|
||||
// notify the observer if it's been sufficiently long
|
||||
@@ -192,7 +199,7 @@ public abstract class Downloader extends Thread
|
||||
|
||||
/**
|
||||
* Accomplishes the copying of the resource from remote location to
|
||||
* local location using transport-specific code
|
||||
* local location using protocol-specific code
|
||||
*/
|
||||
protected abstract void doDownload (Resource rsrc) throws IOException;
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ import com.samskivert.io.StreamUtil;
|
||||
import com.threerings.getdown.Log;
|
||||
import com.threerings.getdown.data.Resource;
|
||||
|
||||
/**
|
||||
* Implements downloading files over HTTP
|
||||
*/
|
||||
public class HTTPDownloader extends Downloader
|
||||
{
|
||||
public HTTPDownloader (List<Resource> resources, Observer obs)
|
||||
@@ -40,6 +43,7 @@ public class HTTPDownloader extends Downloader
|
||||
return ucon.getContentLength();
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
protected void doDownload (Resource rsrc)
|
||||
throws IOException
|
||||
{
|
||||
|
||||
@@ -10,6 +10,9 @@ import org.klomp.snark.SnarkShutdown;
|
||||
import com.threerings.getdown.Log;
|
||||
import com.threerings.getdown.data.Resource;
|
||||
|
||||
/**
|
||||
* Implements downloading data using BitTorrent
|
||||
*/
|
||||
public class TorrentDownloader extends Downloader
|
||||
{
|
||||
public TorrentDownloader (List<Resource> resources, Observer obs)
|
||||
@@ -24,7 +27,7 @@ public class TorrentDownloader extends Downloader
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
// documentation inherited
|
||||
protected long checkSize(Resource rsrc)
|
||||
throws IOException
|
||||
{
|
||||
@@ -44,7 +47,7 @@ public class TorrentDownloader extends Downloader
|
||||
return length;
|
||||
}
|
||||
|
||||
@Override
|
||||
// documentation inherited
|
||||
protected void doDownload(Resource rsrc)
|
||||
throws IOException
|
||||
{
|
||||
@@ -75,9 +78,19 @@ public class TorrentDownloader extends Downloader
|
||||
snark.shutdown();
|
||||
}
|
||||
|
||||
/** Keeps a mapping of resource names to torrent downloaders */
|
||||
protected HashMap<Resource, Snark> _torrentmap =
|
||||
new HashMap<Resource, Snark>();
|
||||
|
||||
/** If we fail, revert to using this HTTP download transport */
|
||||
protected HTTPDownloader _fallback = null;
|
||||
|
||||
/** The length of time before we check for adequate progress*/
|
||||
protected static final long TIME_THRESHOLD = 60 * 1000l;
|
||||
|
||||
/**
|
||||
* The minimum amount of data that must be downloaded within the
|
||||
* initial period in order to continue using BitTorrent
|
||||
*/
|
||||
protected static final long SIZE_THRESHOLD = 4000l;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user