|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.limegroup.gnutella.uploader.AbstractUploader
public abstract class AbstractUploader
Provides an implementation of the Uploader interface.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.limegroup.gnutella.Uploader |
|---|
Uploader.UploadStatus |
| Nested classes/interfaces inherited from interface org.limewire.io.IpPort |
|---|
IpPort.IpComparator, IpPort.IpPortComparator |
| Nested classes/interfaces inherited from interface org.limewire.io.Address |
|---|
Address.EventType |
| Field Summary |
|---|
| Fields inherited from interface com.limegroup.gnutella.Uploader |
|---|
BITTORRENT_UPLOAD |
| Fields inherited from interface org.limewire.io.Connectable |
|---|
COMPARATOR, EMPTY_LIST, EMPTY_SET |
| Fields inherited from interface org.limewire.io.IpPort |
|---|
IP_COMPARATOR |
| Constructor Summary | |
|---|---|
AbstractUploader(String fileName,
HTTPUploadSession session,
TcpBandwidthStatistics tcpBandwidthStatistics)
|
|
| Method Summary | |
|---|---|
void |
addAmountUploaded(int written)
Increases the amount of uploaded bytes. |
long |
amountUploaded()
Returns the amount that of data that has been uploaded. |
String |
getAddress()
Returns the address of the host that initiated this upload. |
String |
getAddressDescription()
|
float |
getAverageBandwidth()
Returns the overall averaged bandwidth between all calls of measureBandwidth. |
String |
getCustomIconDescriptor()
|
FileDesc |
getFileDesc()
Returns the FileDesc of the file being uploaded. |
String |
getFileName()
returns the name of the file being uploaded. |
long |
getFileSize()
returns the length of the file being uploaded. |
int |
getGnutellaPort()
return the port of the gnutella-client host (not the HTTP port) |
String |
getHost()
returns the string representation of the IP Address of the host being uploaded to. |
boolean |
getIgnoreTotalAmountUploaded()
Returns true, if the amount uploaded in previous sessions is not returned by getTotalAmountUploaded(). |
int |
getIndex()
returns the index of the file being uploaded. |
InetAddress |
getInetAddress()
Returns the address of the host that initiated this session. |
InetSocketAddress |
getInetSocketAddress()
Returns a combination of getInetAddress and getPort. |
Uploader.UploadStatus |
getLastTransferState()
Returns the last transfer state of this uploader. |
float |
getMeasuredBandwidth()
Returns the throughput of this in kilobytes/sec (KB/s) between the last two calls to measureBandwidth, or 0.0 if unknown. |
int |
getPort()
Returns the Gnutella Port, if one was provided. |
int |
getQueuePosition()
Returns the queued position if queued. |
HTTPUploadSession |
getSession()
Returns the upload session that is associated with the connection. |
Uploader.UploadStatus |
getState()
Returns the current state of this uploader. |
long |
getTotalAmountUploaded()
Returns the amount of data that this uploader and all previous uploaders exchanging this file have uploaded. |
UploadType |
getUploadType()
Returns the kind of upload this is (shared file, browse host, malformed request, etc..) |
String |
getUserAgent()
return the userAgent |
boolean |
isBrowseHostEnabled()
returns true if browse host is enabled, false if it is not. |
protected boolean |
isFirstReply()
Returns true, if this is this uploader represents the first request. |
boolean |
isForcedShare()
|
boolean |
isInactive()
Returns whether or not this upload is in what is considered an "inactive" state, such as completed or aborted. |
boolean |
isPriorityShare()
|
boolean |
isTLSCapable()
Returns true if the socket this is on is currently using TLS. |
void |
measureBandwidth()
Measures the data throughput since the last call to measureBandwidth. |
void |
reinitialize()
Reinitializes this uploader for a new request. |
void |
setBrowseHostEnabled(boolean browseHostEnabled)
Sets the flag returned by isBrowseHostEnabled(). |
void |
setFileDesc(FileDesc fd)
Sets the file that is being uploaded. |
void |
setFileSize(long fileSize)
Returns the file size returned by getFileSize(). |
void |
setGnutellaPort(int port)
Sets the port returned by getGnutellaPort(). |
void |
setHost(String host)
|
void |
setIgnoreTotalAmountUploaded(boolean ignoreTotalAmountUploaded)
If set to true, the amount uploaded in previous sessions is not returned by getTotalAmountUploaded(). |
void |
setState(Uploader.UploadStatus state)
|
void |
setTotalAmountUploadedBefore(int totalAmountReadBefore)
Sets the amount uploaded in previous sessions. |
void |
setUploadType(UploadType type)
Sets the type returned by getUploadType(). |
void |
setUserAgent(String userAgent)
Sets the user agent returned by getUserAgent(). |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.limegroup.gnutella.Uploader |
|---|
getFile, getNumUploadConnections, getUrn, stop |
| Methods inherited from interface org.limewire.io.Address |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public AbstractUploader(String fileName,
HTTPUploadSession session,
TcpBandwidthStatistics tcpBandwidthStatistics)
| Method Detail |
|---|
public void reinitialize()
public void setFileDesc(FileDesc fd)
fd - the file being uploaded
IOException - if the file cannot be read from the disk.public void setState(Uploader.UploadStatus state)
public int getQueuePosition()
getQueuePosition in interface Uploaderpublic void addAmountUploaded(int written)
written - number of bytes transferredpublic boolean isInactive()
isInactive in interface Uploaderpublic long getFileSize()
Uploader
getFileSize in interface Uploaderpublic int getIndex()
Uploader
getIndex in interface Uploaderpublic String getFileName()
Uploader
getFileName in interface Uploaderpublic Uploader.UploadStatus getState()
Uploader
getState in interface Uploaderpublic Uploader.UploadStatus getLastTransferState()
Uploader
getLastTransferState in interface Uploaderpublic String getHost()
Uploader
getHost in interface Uploaderpublic boolean isBrowseHostEnabled()
Uploader
isBrowseHostEnabled in interface Uploaderpublic int getGnutellaPort()
Uploader
getGnutellaPort in interface Uploaderpublic String getUserAgent()
Uploader
getUserAgent in interface Uploaderpublic boolean isForcedShare()
public boolean isPriorityShare()
protected boolean isFirstReply()
public long amountUploaded()
UploaderUploader.getTotalAmountUploaded() for the entire amount
uploaded.
Note: This method was previously called "amountRead", but the name was changed to make more sense.
amountUploaded in interface Uploaderpublic long getTotalAmountUploaded()
Uploader
getTotalAmountUploaded in interface Uploaderpublic FileDesc getFileDesc()
Uploader
getFileDesc in interface Uploaderpublic void measureBandwidth()
BandwidthTrackermeasureBandwidth.
This value can be read by calling getMeasuredBandwidth.
measureBandwidth in interface BandwidthTracker
public float getMeasuredBandwidth()
throws InsufficientDataException
BandwidthTrackermeasureBandwidth, or 0.0 if unknown.
getMeasuredBandwidth in interface BandwidthTrackerInsufficientDataExceptionpublic float getAverageBandwidth()
BandwidthTrackermeasureBandwidth.
getAverageBandwidth in interface BandwidthTrackerpublic String getCustomIconDescriptor()
getCustomIconDescriptor in interface Uploaderpublic UploadType getUploadType()
Uploader
getUploadType in interface Uploaderpublic void setUploadType(UploadType type)
getUploadType().
public void setBrowseHostEnabled(boolean browseHostEnabled)
isBrowseHostEnabled().
public void setGnutellaPort(int port)
getGnutellaPort().
public void setTotalAmountUploadedBefore(int totalAmountReadBefore)
totalAmountReadBefore is != 0,
getTotalAmountUploaded() will use that value to calculate the
total amount uploaded instead of relying on the value maintained by this
uploader.
public void setUserAgent(String userAgent)
getUserAgent().
public String toString()
toString in class Objectpublic HTTPUploadSession getSession()
public void setFileSize(long fileSize)
getFileSize().
fileSize - must be greater than 0public boolean getIgnoreTotalAmountUploaded()
getTotalAmountUploaded().
setIgnoreTotalAmountUploaded(boolean)public void setIgnoreTotalAmountUploaded(boolean ignoreTotalAmountUploaded)
getTotalAmountUploaded().
Note: This is reset to false by reinitialize().
getIgnoreTotalAmountUploaded()public void setHost(String host)
public boolean isTLSCapable()
isTLSCapable in interface Connectablepublic String getAddress()
getAddress in interface IpPortpublic InetAddress getInetAddress()
getInetAddress in interface IpPortpublic InetSocketAddress getInetSocketAddress()
getInetSocketAddress in interface IpPortpublic String getAddressDescription()
getAddressDescription in interface Addresspublic int getPort()
getPort in interface IpPort
|
LimeWire Consolidated API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||