javazoom.download
Class DownloadSource

java.lang.Object
  |
  +--javazoom.download.DownloadSource
Direct Known Subclasses:
DownloadDatabaseSource, DownloadFolderSource, DownloadZipSource

public abstract class DownloadSource
extends java.lang.Object

This class defines the API a DownloadSource extended class must implement. Depending on input XML file, Download4J will instanciate the needed DownloadSource.


Constructor Summary
DownloadSource(Config conf)
           
 
Method Summary
abstract  void download(FileInfo fi, java.io.OutputStream out)
          Sends file to download (binary) to end-user.
 Config getConfig()
          Returns current Config (Folder, Zip or Database)
abstract  int getDataLength(FileInfo fi)
          Returns file length or -1 if file is not found or not readable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DownloadSource

public DownloadSource(Config conf)
Method Detail

getConfig

public Config getConfig()
Returns current Config (Folder, Zip or Database)

Returns:
current Config

getDataLength

public abstract int getDataLength(FileInfo fi)
Returns file length or -1 if file is not found or not readable.

Parameters:
fi - FileInfo to download
Returns:
file's length or -1

download

public abstract void download(FileInfo fi,
                              java.io.OutputStream out)
                       throws java.io.IOException
Sends file to download (binary) to end-user. This method will run in a thread created for each end-user.

Parameters:
fi - FileInfo to download
Throws:
java.io.IOException