org.lastbamboo.common.download
Class LaunchFileTrackerAdapter

java.lang.Object
  extended by org.lastbamboo.common.download.LaunchFileTrackerAdapter
All Implemented Interfaces:
LaunchFileTracker, org.littleshoot.util.LongRangeListener

public class LaunchFileTrackerAdapter
extends Object
implements LaunchFileTracker

Adapter class for file launchers. Can be used a stub for failed downloaders or for anything else.


Constructor Summary
LaunchFileTrackerAdapter()
           
 
Method Summary
 int getActiveWriteCalls()
          Accessor for the number of active writers.
 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

LaunchFileTrackerAdapter

public LaunchFileTrackerAdapter()
Method Detail

getActiveWriteCalls

public int getActiveWriteCalls()
Description copied from interface: LaunchFileTracker
Accessor for the number of active writers.

Specified by:
getActiveWriteCalls in interface LaunchFileTracker
Returns:
The number of active writers.

onDownloadStopped

public void onDownloadStopped()
Description copied from interface: LaunchFileTracker
Called when a download is stopped.

Specified by:
onDownloadStopped in interface LaunchFileTracker

onFailure

public void onFailure()
Description copied from interface: LaunchFileTracker
Called when a download fails for any reason.

Specified by:
onFailure in interface LaunchFileTracker

onFileComplete

public void onFileComplete()
Description copied from interface: LaunchFileTracker
Called when the file download has completed.

Specified by:
onFileComplete in interface LaunchFileTracker

waitForLaunchersToComplete

public void waitForLaunchersToComplete()
Description copied from interface: LaunchFileTracker
Waits until all active launcher have finished their writes, typically to the browser.

Specified by:
waitForLaunchersToComplete in interface LaunchFileTracker

write

public void write(OutputStream os,
                  boolean cancelOnStreamClose)
           throws IOException
Description copied from interface: LaunchFileTracker
Writes the file to the specified stream.

Specified by:
write in interface LaunchFileTracker
Parameters:
os - The stream to write to.
Throws:
IOException - If there's any read or write error writing to the stream.

onRangeComplete

public void onRangeComplete(org.apache.commons.lang.math.LongRange range)
Specified by:
onRangeComplete in interface org.littleshoot.util.LongRangeListener


Copyright © 2013 LittleShoot. All Rights Reserved.