LimeWire Consolidated API

com.limegroup.gnutella.uploader
Class HTTPUploader

java.lang.Object
  extended by com.limegroup.gnutella.uploader.AbstractUploader
      extended by com.limegroup.gnutella.uploader.HTTPUploader
All Implemented Interfaces:
BandwidthTracker, Uploader, Address, Connectable, IpPort

public class HTTPUploader
extends AbstractUploader
implements Uploader

Maintains state for an HTTP upload.


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
HTTPUploader(String fileName, HTTPUploadSession session)
           
HTTPUploader(String fileName, HTTPUploadSession session, TcpBandwidthStatistics tcpBandwidthStatistics)
           
 
Method Summary
 boolean containedRangeRequest()
           
 AltLocTracker getAltLocTracker()
           
 InetAddress getConnectedHost()
           
 File getFile()
          Returns the file backing this uploader.
 org.apache.http.HttpResponse getLastResponse()
           
 String getMethod()
           
 int getNumUploadConnections()
          Returns the number of connections we are currently uplaoding to.
 PushEndpoint getPushEndpoint()
           
 URN getRequestedURN()
          Returns the content URN that the client asked for.
 long getStartTime()
          Returns the time when the upload of content was started.
 long getUploadBegin()
          Returns the index of the first byte of the file to upload.
 long getUploadEnd()
          Returns the exclusive index of the last byte to upload.
 URN getUrn()
          Returns the URN for the file backing this uploader.
 boolean isBrowseHostEnabled()
          returns true if browse host is enabled, false if it is not.
 boolean isPartial()
           
 boolean isVisible()
           
 void reinitialize()
          Reinitializes this uploader for a new request.
 void setContainedRangeRequest(boolean containedRangeRequest)
           
 void setFile(File file)
           
 void setFileDesc(FileDesc fd)
          Sets the file that is being uploaded.
 void setLastResponse(org.apache.http.HttpResponse lastResponse)
           
 void setMethod(String method)
           
 void setPushEndpoint(PushEndpoint pushEndpoint)
           
 void setRequestedURN(URN requestedURN)
           
 void setStartTime(long startTime)
           
 void setSupportsQueueing(boolean supportsQueueing)
           
 void setUploadBegin(long uploadBegin)
           
 void setUploadEnd(long uploadEnd)
           
 void setVisible(boolean visible)
           
 void stop()
          Stops this upload.
 boolean supportsQueueing()
           
 boolean validateRange()
          Validates the byte range to upload.
 
Methods inherited from class com.limegroup.gnutella.uploader.AbstractUploader
addAmountUploaded, amountUploaded, getAddress, getAddressDescription, getAverageBandwidth, getCustomIconDescriptor, getFileDesc, getFileName, getFileSize, getGnutellaPort, getHost, getIgnoreTotalAmountUploaded, getIndex, getInetAddress, getInetSocketAddress, getLastTransferState, getMeasuredBandwidth, getPort, getQueuePosition, getSession, getState, getTotalAmountUploaded, getUploadType, getUserAgent, isFirstReply, isForcedShare, isInactive, isPriorityShare, isTLSCapable, measureBandwidth, setBrowseHostEnabled, setFileSize, setGnutellaPort, setHost, setIgnoreTotalAmountUploaded, setState, setTotalAmountUploadedBefore, setUploadType, setUserAgent, 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
amountUploaded, getCustomIconDescriptor, getFileDesc, getFileName, getFileSize, getGnutellaPort, getHost, getIndex, getLastTransferState, getQueuePosition, getState, getTotalAmountUploaded, getUploadType, getUserAgent, isInactive
 
Methods inherited from interface com.limegroup.gnutella.BandwidthTracker
getAverageBandwidth, getMeasuredBandwidth, measureBandwidth
 
Methods inherited from interface org.limewire.io.Connectable
isTLSCapable
 
Methods inherited from interface org.limewire.io.IpPort
getAddress, getInetAddress, getInetSocketAddress, getPort
 
Methods inherited from interface org.limewire.io.Address
equals, getAddressDescription, hashCode
 

Constructor Detail

HTTPUploader

public HTTPUploader(String fileName,
                    HTTPUploadSession session)

HTTPUploader

public HTTPUploader(String fileName,
                    HTTPUploadSession session,
                    TcpBandwidthStatistics tcpBandwidthStatistics)
Method Detail

reinitialize

public void reinitialize()
Description copied from class: AbstractUploader
Reinitializes this uploader for a new request.

Overrides:
reinitialize in class AbstractUploader

setFileDesc

public void setFileDesc(FileDesc fd)
Description copied from class: AbstractUploader
Sets the file that is being uploaded.

Overrides:
setFileDesc in class AbstractUploader
Parameters:
fd - the file being uploaded

setFile

public void setFile(File file)

getConnectedHost

public InetAddress getConnectedHost()

stop

public void stop()
Description copied from interface: Uploader
Stops this upload. If the download is already stopped, it does nothing.

Specified by:
stop in interface Uploader

getUploadBegin

public long getUploadBegin()
Returns the index of the first byte of the file to upload.


getUploadEnd

public long getUploadEnd()
Returns the exclusive index of the last byte to upload.


containedRangeRequest

public boolean containedRangeRequest()

validateRange

public boolean validateRange()
Validates the byte range to upload. Shrinks the range to a valid range if it was explicitly requested.

Returns:
true, if the upload end and upload begin are set to valid values

getRequestedURN

public URN getRequestedURN()
Returns the content URN that the client asked for.


setRequestedURN

public void setRequestedURN(URN requestedURN)

supportsQueueing

public boolean supportsQueueing()

setSupportsQueueing

public void setSupportsQueueing(boolean supportsQueueing)

getAltLocTracker

public AltLocTracker getAltLocTracker()

setUploadBegin

public void setUploadBegin(long uploadBegin)

setUploadEnd

public void setUploadEnd(long uploadEnd)

setContainedRangeRequest

public void setContainedRangeRequest(boolean containedRangeRequest)

getStartTime

public long getStartTime()
Returns the time when the upload of content was started.


setStartTime

public void setStartTime(long startTime)

isPartial

public boolean isPartial()

isVisible

public boolean isVisible()

setVisible

public void setVisible(boolean visible)

getMethod

public String getMethod()

setMethod

public void setMethod(String method)

setLastResponse

public void setLastResponse(org.apache.http.HttpResponse lastResponse)

getLastResponse

public org.apache.http.HttpResponse getLastResponse()

isBrowseHostEnabled

public boolean isBrowseHostEnabled()
Description copied from interface: Uploader
returns true if browse host is enabled, false if it is not.

Specified by:
isBrowseHostEnabled in interface Uploader
Overrides:
isBrowseHostEnabled in class AbstractUploader

setPushEndpoint

public void setPushEndpoint(PushEndpoint pushEndpoint)

getPushEndpoint

public PushEndpoint getPushEndpoint()

getFile

public File getFile()
Description copied from interface: Uploader
Returns the file backing this uploader.

Specified by:
getFile in interface Uploader
Returns:
null if an entity different from a file is uploaded

getUrn

public URN getUrn()
Description copied from interface: Uploader
Returns the URN for the file backing this uploader.

Specified by:
getUrn in interface Uploader

getNumUploadConnections

public int getNumUploadConnections()
Description copied from interface: Uploader
Returns the number of connections we are currently uplaoding to.

Specified by:
getNumUploadConnections in interface Uploader

LimeWire Consolidated API

Copyright © 2009. All Rights Reserved.