public class ClientDownloadUDP extends ClientDownload
client, DIFF_PERCENT_PROGRESS, DIFF_TIME_PROGRESS_MILLIS, dirStorage, filename, hash512, hostList, lastPercentProgress, lastTimeProgress, logger, MAX_PARTIAL_SIZE, offsetsPending, offsetsToAsk, partsSubdir, ratioUpdater, size, sockList, stop, success, tracker
Constructor and Description |
---|
ClientDownloadUDP(java.lang.String filename,
java.util.List<HostItem> hostList,
java.lang.String partsSubdir,
java.lang.String dirStorage,
Logger logger,
HostItem client,
HostItem tracker)
Constructor with parameters: filename, list of hosts, parts subdirectory and dirStorage
|
Modifier and Type | Method and Description |
---|---|
protected void |
closeHostItemSocket(HostItem hostItem)
Close HostItem socket
|
protected ClientDownloadPart |
createDownloadPart(HostItem hostItem)
Create a clientDownloadPart
|
protected <T extends Payload> |
createProtocolP2PPacket(T payload)
Create packets
|
protected java.lang.Object |
getHostItemSocket(HostItem hostItem)
Getter for HostItem socket
|
protected void |
writeLog(java.lang.Exception e,
LogLevel logLevel)
Implementation of writeLog
|
protected void |
writeLog(java.lang.String text,
LogLevel logLevel)
Implementation of writeLog
|
assignTasks, checkTasksStatus, getHashSum512, getHashSum512, getSuccess, init, initThreads, printProgression, purgeList, reassembleFile, run, sendRatioUpdate, setSize, setStop, stopTasks
sendEmptyDirectory, sendEmptyFile, sendInternalError, sendNotATracker, sendNotFound, sendUnknownHost
public ClientDownloadUDP(java.lang.String filename, java.util.List<HostItem> hostList, java.lang.String partsSubdir, java.lang.String dirStorage, Logger logger, HostItem client, HostItem tracker)
filename
- name of file to downloadhostList
- list of serverspartsSubdir
- directory to store .part filesdirStorage
- directory to write assembled filelogger
- Loggerclient
- HostItem of the applicationtracker
- HostItem of the trackerprotected ClientDownloadPart createDownloadPart(HostItem hostItem)
createDownloadPart
in class ClientDownload
hostItem
- Hostitem of the serverprotected void writeLog(java.lang.String text, LogLevel logLevel)
writeLog
in class ServeErrors
text
- Text to loglogLevel
- level of loggingprotected void writeLog(java.lang.Exception e, LogLevel logLevel)
writeLog
in class ServeErrors
e
- exception to loglogLevel
- level of loggingprotected <T extends Payload> ProtocolP2PPacket<T> createProtocolP2PPacket(T payload)
createProtocolP2PPacket
in class ServeErrors
payload
- Payloadprotected java.lang.Object getHostItemSocket(HostItem hostItem) throws java.net.SocketException, java.net.UnknownHostException, java.io.IOException
getHostItemSocket
in class ClientDownload
hostItem
- HostItemçjava.net.SocketException
java.net.UnknownHostException
java.io.IOException
protected void closeHostItemSocket(HostItem hostItem)
closeHostItemSocket
in class ClientDownload
hostItem
- HostItem