org.klomp.snark
Interface StorageListener

All Known Implementing Classes:
Snark

public interface StorageListener

Callback used when Storage changes.


Method Summary
 void setWantedPieces(Storage storage)
          Reset the peer's wanted pieces table Call after the storage double-check fails
 void storageAllChecked(Storage storage)
          Called when all pieces in the storage have been checked.
 void storageAllocated(Storage storage, long length)
          Called to indicate that length bytes have been allocated.
 void storageChecked(Storage storage, int num, boolean checked)
          Called when storage is being checked and the num piece of that total pieces has been checked.
 void storageCompleted(Storage storage)
          Called the one time when the data is completely received and checked.
 void storageCreateFile(Storage storage, java.lang.String name, long length)
          Called when the storage creates a new file of a given length.
 

Method Detail

storageCreateFile

void storageCreateFile(Storage storage,
                       java.lang.String name,
                       long length)
Called when the storage creates a new file of a given length.


storageAllocated

void storageAllocated(Storage storage,
                      long length)
Called to indicate that length bytes have been allocated.


storageChecked

void storageChecked(Storage storage,
                    int num,
                    boolean checked)
Called when storage is being checked and the num piece of that total pieces has been checked. When the piece hash matches the expected piece hash checked will be true, otherwise it will be false.


storageAllChecked

void storageAllChecked(Storage storage)
Called when all pieces in the storage have been checked. Does not mean that the storage is complete, just that the state of the storage is known.


storageCompleted

void storageCompleted(Storage storage)
Called the one time when the data is completely received and checked.


setWantedPieces

void setWantedPieces(Storage storage)
Reset the peer's wanted pieces table Call after the storage double-check fails