|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.lastbamboo.common.download.RangeTrackerImpl
public class RangeTrackerImpl
Class for keeping track of ranges for a single download. The algorithm for choosing a range size is important for making downloads as efficient as possible. A base
| Constructor Summary | |
|---|---|
RangeTrackerImpl(long fileSize,
int numSources)
Creates a new range tracker for a file of the specified size. |
|
RangeTrackerImpl(long fileSize,
int numSources,
RangeSizeSelector rangeSizeSelector)
Creates a new range tracker for a file of the specified size. |
|
| Method Summary | |
|---|---|
long |
getBytesRead()
Accessor for the number of bytes read. |
org.littleshoot.util.Optional<org.apache.commons.lang.math.LongRange> |
getNextRange()
Gets the next range to download. |
int |
getNumChunks()
Accessor for the number of chunks to download. |
boolean |
hasMoreRanges()
Returns whether or not there are available ranges to download. |
void |
onRangeComplete(org.apache.commons.lang.math.LongRange range)
Called when we've completed downloading the specified range. |
void |
onRangeFailed(org.apache.commons.lang.math.LongRange range)
Called when the attempt to download the specified range has failed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RangeTrackerImpl(long fileSize,
int numSources)
fileSize - The size of the file we're downloading.numSources - The number of sources for the download.
public RangeTrackerImpl(long fileSize,
int numSources,
RangeSizeSelector rangeSizeSelector)
fileSize - The size of the file we're downloading.numSources - The number of sources for the download.rangeSizeSelector - The class for selecting the size of ranges.| Method Detail |
|---|
public org.littleshoot.util.Optional<org.apache.commons.lang.math.LongRange> getNextRange()
RangeTracker
getNextRange in interface RangeTrackerpublic int getNumChunks()
RangeTracker
getNumChunks in interface RangeTrackerpublic boolean hasMoreRanges()
hasMoreRanges in interface RangeTrackertrue if there are more ranges to download,
otherwise false.public void onRangeComplete(org.apache.commons.lang.math.LongRange range)
onRangeComplete in interface RangeTrackerrange - The completed range.public void onRangeFailed(org.apache.commons.lang.math.LongRange range)
onRangeFailed in interface RangeTrackerrange - The range that could not be downloaded.public long getBytesRead()
RangeTracker
getBytesRead in interface RangeTracker
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||