- All Known Implementing Classes:
SnarkManager, UpdateRunner
public interface CompleteListener
Callback for Snark events.
Method Summary
All MethodsModifier and TypeMethodDescriptionvoidaddMessage(Snark snark, String message) Called to display a status or error message in the torrent's UI.voidCalled when the torrent hits an unrecoverable error and has stopped.The bandwidth listener for the torrent.getSavedComments(Snark snark) The saved comments.getSavedTorrentBitField(Snark snark) Returns the saved bitfield for the torrent.longgetSavedTorrentTime(Snark snark) Returns the saved time for the torrent's last modification.longgetSavedUploaded(Snark snark) The saved uploaded bytes.gotMetaInfo(Snark snark) We transitioned from magnet mode, we have now initialized our metainfo and storage.voidCalled each time a single piece is downloaded and verified.voidlocked_saveComments(Snark snark, CommentSet comments) Persist a comment set under the torrent's own lock, so a comment fetched from a tracker is not written concurrently with the torrenting thread.booleanWhether the torrent should auto-start.voidtorrentComplete(Snark snark) Called when all pieces of the torrent have been downloaded and verified.voidupdateStatus(Snark snark) Called when the torrent status should be updated (e.g., peer count changed).
Method Details
torrentComplete
Called when all pieces of the torrent have been downloaded and verified.- Parameters:
snark- the Snark instance that completed
updateStatus
Called when the torrent status should be updated (e.g., peer count changed).- Parameters:
snark- the Snark instance to update status for
gotMetaInfo
We transitioned from magnet mode, we have now initialized our metainfo and storage. The listener should now call getMetaInfo() and save the data to disk.- Parameters:
snark- the Snark instance that just initialized its metainfo and storage- Returns:
- the new name for the torrent or null on error
fatal
addMessage
gotPiece
Called each time a single piece is downloaded and verified.- Parameters:
snark- the Snark instance that downloaded the piece
getSavedTorrentTime
Returns the saved time for the torrent's last modification.- Parameters:
snark- the Snark instance holding the stored timestamp- Returns:
- the saved torrent time in milliseconds
getSavedTorrentBitField
getSavedUploaded
The saved uploaded bytes.- Parameters:
snark- the Snark instance to read the uploaded byte count from- Returns:
- the saved uploaded
getSavedComments
The saved comments.- Parameters:
snark- the Snark instance to read the comment set from- Returns:
- the comment text as saved, or null
locked_saveComments
Persist a comment set under the torrent's own lock, so a comment fetched from a tracker is not written concurrently with the torrenting thread.- Parameters:
snark- the Snark instance whose torrent lock is heldcomments- the comment set to write out while the lock is held
shouldAutoStart
boolean shouldAutoStart()Whether the torrent should auto-start.- Returns:
- whether auto start
getBandwidthListener
BandwidthListener getBandwidthListener()The bandwidth listener for the torrent.- Returns:
- the bandwidth listener