javazoom.download
Class DownloadSource

java.lang.Object
  extended byjavazoom.download.DownloadSource
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DownloadDatabaseSource, DownloadFolderSource, DownloadZipSource

public abstract class DownloadSource
extends java.lang.Object
implements java.io.Serializable

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

See Also:
Serialized Form

Constructor Summary
DownloadSource(java.util.Properties props)
           
 
Method Summary
abstract  void download(FileInfo fi, java.io.OutputStream out)
          Sends file to download (binary) to end-user.
abstract  int getDataLength(FileInfo fi)
          Returns file length or -1 if file is not found or not readable.
 java.util.Properties getMeta()
           
abstract  java.util.Vector listFiles(Config c, boolean enablesubfolders)
          List files of underlying config.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DownloadSource

public DownloadSource(java.util.Properties props)
Method Detail

getMeta

public java.util.Properties getMeta()

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

listFiles

public abstract java.util.Vector listFiles(Config c,
                                           boolean enablesubfolders)
List files of underlying config.

Parameters:
c -
Returns: