Class FileTransfer

java.lang.Object
  extended byjava.util.Observable
      extended byFileTransfer
All Implemented Interfaces:
Actions, Runnable

public class FileTransfer
extends Observable
implements Runnable, Actions

Receive file from socket and save it to a disk

Version:
1.0
Author:
Adeel Hashmi
See Also:
Observable, Runnable

Constructor Summary
FileTransfer()
           
 
Method Summary
 boolean Alive()
          Check the liveness of Thread
 String getIP()
          Find Remote IP address of connected socket
 int getPort()
          Find Remote port of connected socket
 String getStatus()
          Find and return thread status message
 void run()
          Thread run method
 void setObserver(View v)
          Set the Observer for Observable
protected  void startTransfer(Socket sock)
          Start file receiving thread
protected  void stopTransfer()
          Stop file transfer thread and close socket
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileTransfer

public FileTransfer()
Method Detail

Alive

public boolean Alive()
Check the liveness of Thread

Specified by:
Alive in interface Actions
Returns:
true if the thread still alive

getIP

public String getIP()
Find Remote IP address of connected socket

Specified by:
getIP in interface Actions
Returns:
IP Address

getPort

public int getPort()
Find Remote port of connected socket

Specified by:
getPort in interface Actions
Returns:
port number

getStatus

public String getStatus()
Find and return thread status message

Specified by:
getStatus in interface Actions
Returns:
message

run

public void run()
Thread run method

Specified by:
run in interface Runnable
See Also:
Runnable.run()

setObserver

public void setObserver(View v)
Set the Observer for Observable

Specified by:
setObserver in interface Actions
Parameters:
v - Observer Object

startTransfer

protected void startTransfer(Socket sock)
Start file receiving thread

Parameters:
sock - socket to receive file

stopTransfer

protected void stopTransfer()
Stop file transfer thread and close socket