com.echomine.net
Class FileModel

java.lang.Object
  extended by com.echomine.net.FileModel

public class FileModel
extends java.lang.Object

Contains data and information used by the Handler. This may include information such as filename, filesize, current transfer file size, current status, etc. Default class is basically an empty class that contains no data.

Just as a note, the current filesize acts as both the current file transferred size and also as the initial resume offset before transfer begins.


Constructor Summary
FileModel(java.lang.String filename)
           
FileModel(java.lang.String filename, long resumeOffset)
           
FileModel(java.lang.String filename, java.lang.String saveLocation)
           
FileModel(java.lang.String filename, java.lang.String saveLocation, long resumeOffset)
           
FileModel(java.lang.String filename, java.lang.String saveLocation, long resumeOffset, TransferRateThrottler throttler)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
          the objects are equal if filename, filesize, and savelocation are equal.
 long getCurrentFilesize()
          Obtains the current filesize
 java.lang.String getFilename()
           
 long getFilesize()
           
 java.lang.String getSaveLocation()
           
 TransferRateThrottler getThrottler()
           
 java.lang.String getTimeLeft()
           
 long getTransferBPS()
           
 float getTransferKBPS()
           
 void incrementCurrentFilesize(long increment)
          increments the current filesize by a specified amount
 void reset()
          Resets all the data fields back to the initial state.
 void setCurrentFilesize(long currentFilesize)
          Sets the CURRENT filesize or resume offset depending on whether you are sending or receiving a file
 void setEndTime(long endTime)
          Sets the end time when the transfer is finished
 void setFilename(java.lang.String filename)
          sets the filename you want to retrieve
 void setFilesize(long filesize)
          Sets the filesize or resume offset depending on whether you are sending or receiving a file
 void setSaveLocation(java.lang.String saveLocation)
          sets the location on where to save the file.
 void setStartTime(long startTime)
          Sets the start time when the transfer begins
 void setThrottler(TransferRateThrottler throttler)
          sets the transfer rate throttler to use for throttling the transfer rate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileModel

public FileModel(java.lang.String filename)
Parameters:
filename - the name of the file to request

FileModel

public FileModel(java.lang.String filename,
                 long resumeOffset)
Parameters:
filename - the name of the file to request
resumeOffset - the filesize from where to resume

FileModel

public FileModel(java.lang.String filename,
                 java.lang.String saveLocation)
Parameters:
filename - the name of the file to request
saveLocation - the location (path + filename) to store the file locally

FileModel

public FileModel(java.lang.String filename,
                 java.lang.String saveLocation,
                 long resumeOffset)
Parameters:
filename - the name of the file to request
saveLocation - the location (path + filename) to store the file locally
resumeOffset - the filesize from where to resume

FileModel

public FileModel(java.lang.String filename,
                 java.lang.String saveLocation,
                 long resumeOffset,
                 TransferRateThrottler throttler)
Parameters:
filename - the name of the file to request
saveLocation - the location (path + filename) to store the file locally
resumeOffset - the filesize from where to resume
throttler - the throttler, null if no throttling is done
Method Detail

getFilename

public java.lang.String getFilename()
Returns:
the filename you want to retrieve

setFilename

public void setFilename(java.lang.String filename)
sets the filename you want to retrieve


getFilesize

public long getFilesize()
Returns:
the registered filesize

setFilesize

public void setFilesize(long filesize)
Sets the filesize or resume offset depending on whether you are sending or receiving a file


setCurrentFilesize

public void setCurrentFilesize(long currentFilesize)
Sets the CURRENT filesize or resume offset depending on whether you are sending or receiving a file


getCurrentFilesize

public long getCurrentFilesize()
Obtains the current filesize


incrementCurrentFilesize

public void incrementCurrentFilesize(long increment)
increments the current filesize by a specified amount


getSaveLocation

public java.lang.String getSaveLocation()
Returns:
the save location, or empty string if no save location exists

setSaveLocation

public void setSaveLocation(java.lang.String saveLocation)
sets the location on where to save the file. This is normally called before the real transfer is started. However, you can still make changes during the fileTransferStarting event.


setStartTime

public void setStartTime(long startTime)
Sets the start time when the transfer begins


getTransferKBPS

public float getTransferKBPS()
Returns:
the transfer rate in KBytes/sec

getTransferBPS

public long getTransferBPS()
Returns:
the transfer rate in Bytes/sec.

getTimeLeft

public java.lang.String getTimeLeft()
Returns:
the estimated time left to finish, in the format of HH:MM:SS

reset

public void reset()
Resets all the data fields back to the initial state. This is good when the model is to be reused.


equals

public boolean equals(java.lang.Object obj)
the objects are equal if filename, filesize, and savelocation are equal.

Overrides:
equals in class java.lang.Object

setEndTime

public void setEndTime(long endTime)
Sets the end time when the transfer is finished


setThrottler

public void setThrottler(TransferRateThrottler throttler)
sets the transfer rate throttler to use for throttling the transfer rate


getThrottler

public TransferRateThrottler getThrottler()
Returns:
the current throttler, or null if there is none


Copyright © 2001-2005 Echomine. All Rights Reserved.