|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.lastbamboo.common.download.AbstractDownloader<MsDState>
org.lastbamboo.common.download.MultiSourceDownloader
public final class MultiSourceDownloader
A downloader that can download from multiple sources simultaneously.
| Constructor Summary | |
|---|---|
MultiSourceDownloader(File incompleteFile,
URI uri,
long size,
UriResolver uriResolver,
int connectionsPerHost,
URI expectedSha1,
File downloadsDir,
boolean streamable)
Constructs a new downloader. |
|
| Method Summary | ||
|---|---|---|
|
accept(DownloadVisitor<T> visitor)
Accepts the specified visitor class. |
|
long |
getBytesRead()
|
|
File |
getCompleteFile()
Returns the final path for the file. |
|
String |
getFinalName()
The final name for the file. |
|
File |
getIncompleteFile()
Returns the file to which this downloader downloads the resource. |
|
long |
getSize()
Returns the size of the resource that is downloaded by this downloader. |
|
MsDState |
getState()
Returns the current state of this downloader. |
|
boolean |
isStarted()
Returns whether or not this downloader has already started. |
|
boolean |
isStreamable()
Returns whether or not this downloader can be streamed. |
|
void |
pause()
Pauses the download. |
|
void |
resume()
Resumes the download. |
|
void |
start()
Starts downloading the resource. |
|
void |
stop(boolean removeFiles)
Stops the download. |
|
void |
write(OutputStream os,
boolean cancelOnStreamClose)
Writes the resource that this downloader downloads to a given stream. |
|
| Methods inherited from class org.lastbamboo.common.download.AbstractDownloader |
|---|
addListener, fireStateChanged, getStartTime, removeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.lastbamboo.common.download.Downloader |
|---|
addListener, getStartTime, removeListener |
| Methods inherited from interface org.lastbamboo.common.download.StreamableDownloader |
|---|
getStartTime |
| Constructor Detail |
|---|
public MultiSourceDownloader(File incompleteFile,
URI uri,
long size,
UriResolver uriResolver,
int connectionsPerHost,
URI expectedSha1,
File downloadsDir,
boolean streamable)
incompleteFile - The path for the incomplete file we're downloading
to. This will of course be complete when we're done.uri - The URI for the file.size - The size of the file in bytes.uriResolver - The class we'll use to resolve all initial locations
for the file.connectionsPerHost - The number of connections to allow to each
HTTP server. Multiple connections to HTTP servers can speed up
transfers.expectedSha1 - The expected SHA-1 URN.downloadsDir - The directory we're ultimately downloading to.streamable - Whether or not this download can be streamed.| Method Detail |
|---|
public void start()
Downloader
start in interface Downloader<MsDState>public File getIncompleteFile()
Downloader
getIncompleteFile in interface Downloader<MsDState>public long getSize()
Downloader
getSize in interface Downloader<MsDState>public MsDState getState()
Downloader
getState in interface Downloader<MsDState>public boolean isStarted()
Downloader
isStarted in interface Downloader<MsDState>true if this downloader has already started,
otherwise false.
public void write(OutputStream os,
boolean cancelOnStreamClose)
Downloader
write in interface Downloader<MsDState>os - The output stream to which to write the resource.cancelOnStreamClose - Whether or not the cancel the download
when the stream closes.public void stop(boolean removeFiles)
Downloader
stop in interface Downloader<MsDState>removeFiles - Whether or not to also remove all downloaded files.public void pause()
Downloader
pause in interface Downloader<MsDState>public void resume()
Downloader
resume in interface Downloader<MsDState>public String getFinalName()
Downloader
getFinalName in interface Downloader<MsDState>public File getCompleteFile()
Downloader
getCompleteFile in interface Downloader<MsDState>public <T> T accept(DownloadVisitor<T> visitor)
VisitableDownloader
accept in interface VisitableDownloader<MsDState>T - The type the visitor will return.visitor - The visitor to accept.
public boolean isStreamable()
StreamableDownloader
isStreamable in interface StreamableDownloadertrue if the downloader can be streamed, otherwise
false.public long getBytesRead()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||