Runnable, EepGet.StatusListener, CoordinatorListener, ShutdownListener, StorageListenerpublic class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnable
_util, PROP_MAX_CONNECTIONS| Constructor | Description |
|---|---|
FetchAndAdd(I2PAppContext ctx,
SnarkManager mgr,
String url,
File dataDir) |
Caller should call _mgr.addDownloader(this), which
will start things off.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
attemptFailed(String url,
long bytesTransferred,
long bytesRemaining,
int currentAttempt,
int numRetries,
Exception cause) |
|
void |
attempting(String url) |
|
void |
bytesTransferred(long alreadyTransferred,
int currentWrite,
long bytesTransferred,
long bytesRemaining,
String url) |
alreadyTransferred - total of all attempts, not including currentWrite
If nonzero on the first call, a partial file of that length was found,
_and_ the server supports resume.
|
String |
getBaseName() |
|
long |
getDownloaded() |
|
long |
getDownloadRate() |
|
byte[] |
getInfoHash() |
|
String |
getName() |
|
long |
getNeededLength() |
Bytes still wanted.
|
int |
getPeerCount() |
|
long |
getRemainingLength() |
Bytes not yet in storage.
|
long |
getTotalLength() |
|
int |
getTrackerSeenPeers() |
|
void |
headerReceived(String url,
int attemptNum,
String key,
String val) |
Note: Headers are not processed, and this is not called, for most error response codes,
unless setWriteErrorToOutput() is called before fetch().
|
boolean |
isStopped() |
|
void |
run() |
Set off by startTorrent()
|
void |
startTorrent() |
Start up contacting peers and querying the tracker.
|
void |
stopTorrent() |
Stop contacting the tracker and talking with peers
|
void |
transferComplete(long alreadyTransferred,
long bytesTransferred,
long bytesRemaining,
String url,
String outputFile,
boolean notModified) |
|
void |
transferFailed(String url,
long bytesTransferred,
long bytesRemaining,
int currentAttempt) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddComments, addMessage, getCheckingProgress, getComments, getID, getMetaInfo, getNeeded, getPeerList, getPieceLength, getPieces, getRPCID, getSkippedLength, getStartedTime, getStorage, getTrackerProblems, getTrackerURL, getUploaded, getUploadRate, gotMetaInfo, isAllocating, isAutoStoppable, isChecking, isStarting, overUpBWLimit, overUpBWLimit, overUploadLimit, peerChange, restartAcceptor, setAutoStoppable, setStarting, setTrackerProblems, setTrackerSeenPeers, setWantedPieces, shutdown, stopTorrent, storageAllChecked, storageAllocated, storageChecked, storageCompleted, storageCreateFile, updatePiecePrioritiespublic FetchAndAdd(I2PAppContext ctx, SnarkManager mgr, String url, File dataDir)
dataDir - null to default to snark data directorypublic void startTorrent()
SnarkstartTorrent in class Snarkpublic void stopTorrent()
SnarkstopTorrent in class Snarkpublic String getName()
public String getBaseName()
getBaseName in class Snarkpublic byte[] getInfoHash()
getInfoHash in class Snarkpublic long getTotalLength()
getTotalLength in class Snarkpublic long getRemainingLength()
SnarkgetRemainingLength in class Snarkpublic long getNeededLength()
SnarkgetNeededLength in class Snarkpublic long getDownloadRate()
getDownloadRate in class Snarkpublic long getDownloaded()
getDownloaded in class Snarkpublic int getPeerCount()
getPeerCount in class Snarkpublic int getTrackerSeenPeers()
getTrackerSeenPeers in class Snarkpublic void attemptFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt, int numRetries, Exception cause)
attemptFailed in interface EepGet.StatusListenerpublic void bytesTransferred(long alreadyTransferred,
int currentWrite,
long bytesTransferred,
long bytesRemaining,
String url)
EepGet.StatusListenerbytesTransferred in interface EepGet.StatusListenerpublic void transferComplete(long alreadyTransferred,
long bytesTransferred,
long bytesRemaining,
String url,
String outputFile,
boolean notModified)
transferComplete in interface EepGet.StatusListenerpublic void transferFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt)
transferFailed in interface EepGet.StatusListenerpublic void headerReceived(String url, int attemptNum, String key, String val)
EepGet.StatusListenerheaderReceived in interface EepGet.StatusListenerpublic void attempting(String url)
attempting in interface EepGet.StatusListener