org.alliance.core.comm.filetransfers
Class Download
java.lang.Object
org.alliance.core.comm.filetransfers.Download
public class Download
- extends java.lang.Object
Created by IntelliJ IDEA.
User: maciek
Date: 2006-jan-22
Time: 22:33:24
To change this template use File | Settings | File Templates.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Download
public Download(DownloadManager parent,
Hash root,
BlockStorage storage,
java.lang.String filename,
java.util.ArrayList<java.lang.Integer> guids)
throws java.io.IOException
- Throws:
java.io.IOException
blockMaskReceived
public void blockMaskReceived(int srcGuid,
int hops,
BlockMask bm)
addConnection
public void addConnection(DownloadConnection con)
fileDescriptorReceived
public void fileDescriptorReceived(DownloadConnection source,
FileDescriptor fd)
throws java.io.IOException
- Throws:
java.io.IOException
getFd
public FileDescriptor getFd()
getRoot
public Hash getRoot()
getManager
public DownloadManager getManager()
isDownloadingFd
public boolean isDownloadingFd()
connectionEstablished
public void connectionEstablished(DownloadConnection downloadConnection)
selectBestBlockForDownload
public int selectBestBlockForDownload(Friend remoteFriend)
throws java.io.IOException
- Throws:
java.io.IOException
getPercentComplete
public int getPercentComplete()
throws java.io.IOException
- Throws:
java.io.IOException
getStorage
public BlockStorage getStorage()
setFd
public void setFd(FileDescriptor fd)
checkIfDownloadIsComplete
public boolean checkIfDownloadIsComplete()
isBlockComplete
public boolean isBlockComplete(int blockNumber)
throws java.io.IOException
- Throws:
java.io.IOException
getNConnections
public int getNConnections()
removeConnection
public void removeConnection(DownloadConnection downloadConnection)
throws java.io.IOException
- Throws:
java.io.IOException
getBandwidth
public BandwidthAnalyzer getBandwidth()
isActive
public boolean isActive()
isComplete
public boolean isComplete()
startDownload
public void startDownload()
throws java.io.IOException
- Throws:
java.io.IOException
getState
public Download.State getState()
abortAndRemovePerfmanently
public void abortAndRemovePerfmanently()
throws java.io.IOException
- Throws:
java.io.IOException
addBytesComplete
public void addBytesComplete(int bytes)
getETAInMinutes
public int getETAInMinutes()
getStartedAt
public long getStartedAt()
isInvalid
public boolean isInvalid()
setInvalid
public void setInvalid(boolean invalid)
signalFriendWentOnline
public void signalFriendWentOnline(Friend friend)
throws java.io.IOException
- Throws:
java.io.IOException
signalBlockComplete
public void signalBlockComplete(int blockNumber)
throws java.io.IOException
- Throws:
java.io.IOException
serializeTo
public void serializeTo(java.io.ObjectOutputStream out)
throws java.io.IOException
- Throws:
java.io.IOException
createFrom
public static Download createFrom(java.io.ObjectInputStream in,
DownloadManager m)
throws java.io.IOException
- Throws:
java.io.IOException
getAuxInfoFilename
public java.lang.String getAuxInfoFilename()
getAuxInfoGuids
public java.util.ArrayList<java.lang.Integer> getAuxInfoGuids()
connections
public java.util.Collection<DownloadConnection> connections()