multipart
Class Multipart

java.lang.Object
  extended by multipart.Multipart

public class Multipart
extends java.lang.Object

Implements a multi-part file downloader. The downloader is capable of progressively downloading multi-part files, with parts from multiple sources, and concatenating their data to an output stream.


Constructor Summary
Multipart(IDownloader downloader, java.lang.String manifestURL)
          Creates a new instance of Multipart which will use downloader for all URL access, and subsequent calls to getPart() will begin downloading the multi-part file described at manifestURL.
 
Method Summary
 boolean error()
           
 void getPart(java.io.OutputStream dest)
          Gets the next part (if any) and adds its contents dest.
 void skip()
          Skips any remaining parts in the current alternative, so that the next time getPart() is called, the series of parts specified in the manifest as the next alternative is used instead, re-starting with the first part.
 boolean success()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Multipart

public Multipart(IDownloader downloader,
                 java.lang.String manifestURL)
Creates a new instance of Multipart which will use downloader for all URL access, and subsequent calls to getPart() will begin downloading the multi-part file described at manifestURL. If manifestURL is inaccessible, then error() should return true.

Method Detail

getPart

public void getPart(java.io.OutputStream dest)
Gets the next part (if any) and adds its contents dest. If the download from the current alternative has either succeeded or encountered an error, then nothing should be written to dest, until skip() is called to move on to the next alternative.


skip

public void skip()
Skips any remaining parts in the current alternative, so that the next time getPart() is called, the series of parts specified in the manifest as the next alternative is used instead, re-starting with the first part. If an error has occurred in the current alternative, skipping to the new alternative should reset error() to false. If there is no remaining alternative, error() should return true.


success

public boolean success()
Returns:
true if all parts of the current alternative were downloaded successfully.

error

public boolean error()
Returns:
true if an error has occurred in the current alternative, or if there is no current alternative.