rero.dcc

Class Receive

public class Receive extends ProtocolDCC

Field Summary
protected FiledumpTo
protected FileOutputStreamfileStream
protected longfinalSize
protected static intPACKET_SIZE
protected longreceivedSize
protected longstartSize
Constructor Summary
Receive(String _nickname, File _dumpTo, long _finalSize)
Create a ready to rock and roll receive socket.
Method Summary
voidfireError(String description)
voidfireEvent(String event, String description)
longgetBytesReceived()
return the number of bytes that have been received thus far
longgetExpectedSize()
return the expected size of the file we are receiving
FilegetFile()
return the object pointing to the File we are downloading
longgetStartOffset()
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
longgetTimeRemaining()
return the estimated time remaning in seconds
intgetTransferRate()
return the number of bytes transferred per second
intgetTypeOfDCC()
voidpleaseResume()
voidrun()
voidsetFile(File f)

Field Detail

dumpTo

protected File dumpTo

fileStream

protected FileOutputStream fileStream

finalSize

protected long finalSize

PACKET_SIZE

protected static int PACKET_SIZE

receivedSize

protected long receivedSize

startSize

protected long startSize

Constructor Detail

Receive

public Receive(String _nickname, File _dumpTo, long _finalSize)
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

fireError

public void fireError(String description)

fireEvent

public void fireEvent(String event, String description)

getBytesReceived

public long getBytesReceived()
return the number of bytes that have been received thus far

getExpectedSize

public long getExpectedSize()
return the expected size of the file we are receiving

getFile

public File getFile()
return the object pointing to the File we are downloading

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()

pleaseResume

public void pleaseResume()

run

public void run()

setFile

public void setFile(File f)