Class FishClientDownloadThread

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--FishClientDownloadThread
All Implemented Interfaces:
java.lang.Runnable

public class FishClientDownloadThread
extends java.lang.Thread

Thread that setup communication and do the actual downloading of the requested file propagated from FishClientDownload class.

Version:
1.0
Author:
Björn Bertilsson

Field Summary
protected  int currentBytes
          Number of bytes downloaded
protected  double currentSpeed
          Holds calculated average download speed in kBytes/second
protected  boolean DONE
          Used to indicate if download is completed
protected  boolean ERROR
          Used to indicate if an error in download process has ocurred
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
FishClientDownloadThread(java.lang.String ipAddress, int port, java.lang.String fileName, int count, int fileSize)
          Open connection to the serverpart of the client holding the wanted file.
 
Method Summary
 void run()
          Authorize with the other client and check if file still is shared, then starts downloading it.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DONE

protected boolean DONE
Used to indicate if download is completed


ERROR

protected boolean ERROR
Used to indicate if an error in download process has ocurred


currentBytes

protected int currentBytes
Number of bytes downloaded


currentSpeed

protected double currentSpeed
Holds calculated average download speed in kBytes/second

Constructor Detail

FishClientDownloadThread

public FishClientDownloadThread(java.lang.String ipAddress,
                                int port,
                                java.lang.String fileName,
                                int count,
                                int fileSize)
Open connection to the serverpart of the client holding the wanted file.

Parameters:
ipAddress - IP-address of remote user.
port - Portnumber serving downloads.
fileName - Name of desired file.
count - Index of desired file in the remote users table of locally shared files.
fileSize - Size of desired file.
Method Detail

run

public void run()
Authorize with the other client and check if file still is shared, then starts downloading it.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread