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