|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.lastbamboo.common.download.SingleSourceDownloader
public class SingleSourceDownloader
Downloads data from a single source.
| Constructor Summary | |
|---|---|
SingleSourceDownloader(org.lastbamboo.common.http.client.CommonsHttpClient httpClient,
URI source,
RangeDownloadListener rangeDownloadListener,
SourceRanker downloadSpeedRanker,
RangeTracker rangeTracker,
LaunchFileTracker launchTracker,
RandomAccessFile randomAccessFile)
Creates a downloader for downloading from a specific source. |
|
| Method Summary | |
|---|---|
void |
download(org.apache.commons.lang.math.LongRange range)
Downloads the specified range from the assigned file. |
org.littleshoot.util.Optional<Integer> |
getKbs()
Gets the speed of this downloader in kilobytes per second. |
long |
getNumBytesDownloaded()
Returns the number of bytes downloaded by this downloader. |
long |
getRangeIndex()
Accessor for the byte index of the current range. |
long |
getRangeStartTime()
Accessor for the time the downloader started downloading the current range. |
URI |
getSourceUri()
Returns the source URI for this downloader. |
void |
handleInputStream(InputStream is)
|
void |
issueHeadRequest()
Sends a head request to the server this downloader is downloading from. |
void |
onBadHeader(String header)
|
void |
onBytesRead(int bytesRead)
|
void |
onConnect(long ms)
|
void |
onContentLength(long contentLength)
|
void |
onContentRange(org.apache.commons.lang.math.LongRange range)
|
void |
onCouldNotConnect()
|
void |
onDownloadStarted()
|
void |
onFailure()
|
void |
onHttpException(org.apache.commons.httpclient.HttpException httpException)
|
void |
onMessageBodyRead()
|
void |
onNoTwoHundredOk(int responseCode)
|
void |
onPermanentFailure()
|
void |
onStatusEvent(String status)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SingleSourceDownloader(org.lastbamboo.common.http.client.CommonsHttpClient httpClient,
URI source,
RangeDownloadListener rangeDownloadListener,
SourceRanker downloadSpeedRanker,
RangeTracker rangeTracker,
LaunchFileTracker launchTracker,
RandomAccessFile randomAccessFile)
httpClient - The HTTP client instance to use for performing
downloads.source - The URI for the source to download from.rangeDownloadListener - The listener for range download events.downloadSpeedRanker - The class for ranking sources.rangeTracker - The class for tracking needed ranges in the file.launchTracker - The tracker for bytes to send to the launch file.randomAccessFile - The class to store downloaded bytes to.| Method Detail |
|---|
public void download(org.apache.commons.lang.math.LongRange range)
RangeDownloader
download in interface RangeDownloaderrange - The byte range to download.public void issueHeadRequest()
RangeDownloader
issueHeadRequest in interface RangeDownloaderpublic org.littleshoot.util.Optional<Integer> getKbs()
RangeDownloader
getKbs in interface RangeDownloaderpublic long getNumBytesDownloaded()
RangeDownloader
getNumBytesDownloaded in interface RangeDownloaderpublic URI getSourceUri()
RangeDownloader
getSourceUri in interface RangeDownloader
public void handleInputStream(InputStream is)
throws IOException
handleInputStream in interface org.littleshoot.util.InputStreamHandlerIOExceptionpublic void onContentLength(long contentLength)
onContentLength in interface org.lastbamboo.common.http.client.HttpListenerpublic void onCouldNotConnect()
onCouldNotConnect in interface org.lastbamboo.common.http.client.HttpListenerpublic void onConnect(long ms)
onConnect in interface org.lastbamboo.common.http.client.HttpListenerpublic void onFailure()
onFailure in interface org.lastbamboo.common.http.client.HttpListenerpublic void onPermanentFailure()
onPermanentFailure in interface org.lastbamboo.common.http.client.HttpListenerpublic void onHttpException(org.apache.commons.httpclient.HttpException httpException)
onHttpException in interface org.lastbamboo.common.http.client.HttpListenerpublic void onNoTwoHundredOk(int responseCode)
onNoTwoHundredOk in interface org.lastbamboo.common.http.client.HttpListenerpublic void onMessageBodyRead()
onMessageBodyRead in interface org.lastbamboo.common.http.client.HttpListenerpublic void onBadHeader(String header)
onBadHeader in interface org.lastbamboo.common.http.client.HttpListener
public void onContentRange(org.apache.commons.lang.math.LongRange range)
throws IOException
onContentRange in interface org.lastbamboo.common.http.client.HttpListenerIOExceptionpublic void onStatusEvent(String status)
onStatusEvent in interface org.lastbamboo.common.http.client.HttpListenerpublic void onDownloadStarted()
onDownloadStarted in interface org.lastbamboo.common.http.client.HttpListenerpublic void onBytesRead(int bytesRead)
onBytesRead in interface org.littleshoot.util.WriteListenerpublic long getRangeStartTime()
RangeDownloader
getRangeStartTime in interface RangeDownloaderpublic long getRangeIndex()
RangeDownloader
getRangeIndex in interface RangeDownloaderpublic String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||