com.limegroup.gnutella
Interface Uploader

All Superinterfaces:
BandwidthTracker
All Known Implementing Classes:
HTTPUploader

public interface Uploader
extends BandwidthTracker

This interface outlines the basic functionality for a class that performs uploads.


Field Summary
static int BROWSE_HOST
           
static int COMPLETE
           
static int CONNECTING
           
static int FILE_NOT_FOUND
           
static int FREELOADER
           
static int INTERRUPTED
           
static int LIMIT_REACHED
           
static int MALFORMED_REQUEST
           
static int PUSH_PROXY
           
static int QUEUED
           
static int UNAVAILABLE_RANGE
           
static int UPDATE_FILE
           
static int UPLOADING
           
 
Method Summary
 int amountUploaded()
          returns the amount that of data that has been uploaded.
 int getAmountRequested()
          returns the length of the requested size for uploading
 FileDesc getFileDesc()
          Returns the FileDesc for this uploader -- the file that is being uploaded.
 java.lang.String getFileName()
          returns the name of the file being uploaded.
 int getFileSize()
          returns the length of the file being uploaded.
 int getGnutellaPort()
          return the port of the gnutella-client host (not the HTTP port)
 java.lang.String getHost()
          returns the string representation of the IP Address of the host being uploaded to.
 int getIndex()
          returns the index of the file being uploaded.
 int getLastTransferState()
          Returns the last transfer state of this uploader.
 HTTPRequestMethod getMethod()
          returns the current request method.
 int getQueuePosition()
          Returns the current queue position if queued.
 int getState()
          Returns the current state of this uploader.
 int getTotalAmountUploaded()
          Returns the amount of data that this uploader and all previous uploaders exchanging this file have uploaded.
 java.lang.String getUserAgent()
          return the userAgent
 boolean isBrowseHostEnabled()
          returns true if browse host is enabled, false if it is not.
 boolean isChatEnabled()
          returns true if chat for the host is on, false if it is not.
 boolean isHeaderParsed()
          return whether or not the headers have been parsed
 boolean isInactive()
          Returns whether or not the uploader is in an inactive state.
 void setState(int state)
          Sets the state of this uploader.
 void stop()
          Stops this upload.
 boolean supportsQueueing()
           
 void writeResponse()
           
 
Methods inherited from interface com.limegroup.gnutella.BandwidthTracker
getAverageBandwidth, getMeasuredBandwidth, measureBandwidth
 

Field Detail

CONNECTING

public static final int CONNECTING
See Also:
Constant Field Values

FREELOADER

public static final int FREELOADER
See Also:
Constant Field Values

LIMIT_REACHED

public static final int LIMIT_REACHED
See Also:
Constant Field Values

UPLOADING

public static final int UPLOADING
See Also:
Constant Field Values

COMPLETE

public static final int COMPLETE
See Also:
Constant Field Values

INTERRUPTED

public static final int INTERRUPTED
See Also:
Constant Field Values

FILE_NOT_FOUND

public static final int FILE_NOT_FOUND
See Also:
Constant Field Values

BROWSE_HOST

public static final int BROWSE_HOST
See Also:
Constant Field Values

QUEUED

public static final int QUEUED
See Also:
Constant Field Values

UPDATE_FILE

public static final int UPDATE_FILE
See Also:
Constant Field Values

MALFORMED_REQUEST

public static final int MALFORMED_REQUEST
See Also:
Constant Field Values

PUSH_PROXY

public static final int PUSH_PROXY
See Also:
Constant Field Values

UNAVAILABLE_RANGE

public static final int UNAVAILABLE_RANGE
See Also:
Constant Field Values
Method Detail

stop

public void stop()
Stops this upload. If the download is already stopped, it does nothing.


getFileName

public java.lang.String getFileName()
returns the name of the file being uploaded.


getFileSize

public int getFileSize()
returns the length of the file being uploaded.


getAmountRequested

public int getAmountRequested()
returns the length of the requested size for uploading


getFileDesc

public FileDesc getFileDesc()
Returns the FileDesc for this uploader -- the file that is being uploaded.

Returns:
the FileDesc for this uploader -- the file that is being uploaded, which can be null in cases such as when the file can't be found

getIndex

public int getIndex()
returns the index of the file being uploaded.


amountUploaded

public int amountUploaded()
returns the amount that of data that has been uploaded. this method was previously called "amountRead", but the name was changed to make more sense.


getTotalAmountUploaded

public int getTotalAmountUploaded()
Returns the amount of data that this uploader and all previous uploaders exchanging this file have uploaded.


getHost

public java.lang.String getHost()
returns the string representation of the IP Address of the host being uploaded to.


getState

public int getState()
Returns the current state of this uploader.


getLastTransferState

public int getLastTransferState()
Returns the last transfer state of this uploader. Transfers states are all states except INTERRUPTED, COMPLETE, and CONNECTING.


setState

public void setState(int state)
Sets the state of this uploader.


writeResponse

public void writeResponse()
                   throws java.io.IOException
Throws:
java.io.IOException

isChatEnabled

public boolean isChatEnabled()
returns true if chat for the host is on, false if it is not.


isBrowseHostEnabled

public boolean isBrowseHostEnabled()
returns true if browse host is enabled, false if it is not.


getGnutellaPort

public int getGnutellaPort()
return the port of the gnutella-client host (not the HTTP port)


getUserAgent

public java.lang.String getUserAgent()
return the userAgent


isHeaderParsed

public boolean isHeaderParsed()
return whether or not the headers have been parsed


supportsQueueing

public boolean supportsQueueing()

getMethod

public HTTPRequestMethod getMethod()
returns the current request method.


getQueuePosition

public int getQueuePosition()
Returns the current queue position if queued.


isInactive

public boolean isInactive()
Returns whether or not the uploader is in an inactive state.