public class FetchAndAdd extends Snark implements EepGet.StatusListener, Runnable
_util, PROP_MAX_CONNECTIONS
Constructor and 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 and 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) |
addMessage, getCheckingProgress, 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, updatePiecePriorities
public FetchAndAdd(I2PAppContext ctx, SnarkManager mgr, String url, File dataDir)
dataDir
- null to default to snark data directorypublic void startTorrent()
Snark
startTorrent
in class Snark
public void stopTorrent()
Snark
stopTorrent
in class Snark
public String getName()
public String getBaseName()
getBaseName
in class Snark
public byte[] getInfoHash()
getInfoHash
in class Snark
public long getTotalLength()
getTotalLength
in class Snark
public long getRemainingLength()
Snark
getRemainingLength
in class Snark
public long getNeededLength()
Snark
getNeededLength
in class Snark
public long getDownloadRate()
getDownloadRate
in class Snark
public long getDownloaded()
getDownloaded
in class Snark
public int getPeerCount()
getPeerCount
in class Snark
public int getTrackerSeenPeers()
getTrackerSeenPeers
in class Snark
public void attemptFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt, int numRetries, Exception cause)
attemptFailed
in interface EepGet.StatusListener
public void bytesTransferred(long alreadyTransferred, int currentWrite, long bytesTransferred, long bytesRemaining, String url)
EepGet.StatusListener
bytesTransferred
in interface EepGet.StatusListener
public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile, boolean notModified)
transferComplete
in interface EepGet.StatusListener
public void transferFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt)
transferFailed
in interface EepGet.StatusListener
public void headerReceived(String url, int attemptNum, String key, String val)
EepGet.StatusListener
headerReceived
in interface EepGet.StatusListener
public void attempting(String url)
attempting
in interface EepGet.StatusListener