rero.dcc
Class Send

java.lang.Object
  extended byrero.dcc.ProtocolDCC
      extended byrero.dcc.Send

public class Send
extends ProtocolDCC


Field Summary
protected  long ackSize
           
protected  File dumpFrom
           
protected  FileInputStream fileStream
           
protected  long finalSize
           
protected static int PACKET_SIZE
           
protected  long sentSize
           
protected  long startSize
           
 
Fields inherited from class rero.dcc.ProtocolDCC
DCC_CHAT, DCC_RECEIVE, DCC_SEND, DCC_TIMEOUT, dispatcher, eventData, idleTime, nickname, socket, startTime, state, STATE_CLOSED, STATE_OPEN, STATE_WAIT
 
Constructor Summary
Send(String _nickname, File _dumpFrom)
          Create a ready to rock and roll receive socket.
 
Method Summary
 void fireError(String description)
           
 void fireEvent(String event, String description)
           
 long getAcknowledgedSize()
          return the total number of bytes that have been acknowledged by the user
 long getBytesSent()
          return the total number of bytes that have been sent
 File getFile()
          return the File we are sending to the user
 long getStartOffset()
          return the number of bytes that we started out with (0 normally, however in the case of a resume this number could be anything from 0 up to nearly the size of the file
 long getTimeRemaining()
          return the estimated time remaning in seconds
 int getTransferRate()
          return the number of bytes transferred per second
 int getTypeOfDCC()
          return the type of DCC based on a constant
 boolean resume(long size)
           
 void run()
           
 
Methods inherited from class rero.dcc.ProtocolDCC
announceFramework, close, getIdleTime, getLocalPort, getNickname, getPort, getRemoteAddress, getStartTime, getState, getTotalTime, isConnected, setDCCSocket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PACKET_SIZE

protected static int PACKET_SIZE

dumpFrom

protected File dumpFrom

fileStream

protected FileInputStream fileStream

sentSize

protected long sentSize

ackSize

protected long ackSize

finalSize

protected long finalSize

startSize

protected long startSize
Constructor Detail

Send

public Send(String _nickname,
            File _dumpFrom)
Create a ready to rock and roll receive socket. It is assumed that the File object is either cleared or ready to be resumed. An overwrite command should delete the file first and then start dumping to it. Hopefully this is a safe way to go. Eh?

Method Detail

resume

public boolean resume(long size)

getBytesSent

public long getBytesSent()
return the total number of bytes that have been sent


getAcknowledgedSize

public long getAcknowledgedSize()
return the total number of bytes that have been acknowledged by the user


getFile

public File getFile()
return the File we are sending to the user


getStartOffset

public long getStartOffset()
return the number of bytes that we started out with (0 normally, however in the case of a resume this number could be anything from 0 up to nearly the size of the file


getTimeRemaining

public long getTimeRemaining()
return the estimated time remaning in seconds


getTransferRate

public int getTransferRate()
return the number of bytes transferred per second


getTypeOfDCC

public int getTypeOfDCC()
Description copied from class: ProtocolDCC
return the type of DCC based on a constant

Specified by:
getTypeOfDCC in class ProtocolDCC

run

public void run()
Specified by:
run in class ProtocolDCC

fireError

public void fireError(String description)
Specified by:
fireError in class ProtocolDCC

fireEvent

public void fireEvent(String event,
                      String description)