|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.lastbamboo.common.download.LaunchFileDispatcher
public class LaunchFileDispatcher
Class for dispatching file download events to all the open file launchers/streamers.
| Constructor Summary | |
|---|---|
LaunchFileDispatcher(File incompleteFile,
RandomAccessFile raf,
int initialQueueSize,
URI expectedSha1)
Creates a new tracker for streaming the file to the browser. |
|
| Method Summary | |
|---|---|
void |
addTracker(LaunchFileTracker tracker)
For testing. |
int |
getActiveWriteCalls()
Accessor for the number of active writers. |
Collection<org.apache.commons.lang.math.LongRange> |
getRanges()
Used for testing. |
void |
onDownloadStopped()
Called when a download is stopped. |
void |
onFailure()
Called when a download fails for any reason. |
void |
onFileComplete()
Called when the file download has completed. |
void |
onRangeComplete(org.apache.commons.lang.math.LongRange range)
|
void |
waitForLaunchersToComplete()
Waits until all active launcher have finished their writes, typically to the browser. |
void |
write(OutputStream os,
boolean cancelOnStreamClose)
Writes the file to the specified stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LaunchFileDispatcher(File incompleteFile,
RandomAccessFile raf,
int initialQueueSize,
URI expectedSha1)
incompleteFile - The file on disk.raf - The random access file to copy the downloaded data from.initialQueueSize - The initial size of the queue, loosely based
on number of chunks we're downloading.expectedSha1 - The expected SHA-1 for the file.| Method Detail |
|---|
public void waitForLaunchersToComplete()
LaunchFileTracker
waitForLaunchersToComplete in interface LaunchFileTracker
public void write(OutputStream os,
boolean cancelOnStreamClose)
throws IOException
LaunchFileTracker
write in interface LaunchFileTrackeros - The stream to write to.
IOException - If there's any read or write error writing to the
stream.public void onRangeComplete(org.apache.commons.lang.math.LongRange range)
onRangeComplete in interface org.littleshoot.util.LongRangeListenerpublic Collection<org.apache.commons.lang.math.LongRange> getRanges()
public void addTracker(LaunchFileTracker tracker)
tracker - The tracker.public void onFileComplete()
LaunchFileTracker
onFileComplete in interface LaunchFileTrackerpublic int getActiveWriteCalls()
LaunchFileTracker
getActiveWriteCalls in interface LaunchFileTrackerpublic void onFailure()
LaunchFileTracker
onFailure in interface LaunchFileTrackerpublic void onDownloadStopped()
LaunchFileTracker
onDownloadStopped in interface LaunchFileTracker
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||