javazoom.download
Class DownloadFolderSource

java.lang.Object
  extended byjavazoom.download.DownloadSource
      extended byjavazoom.download.DownloadFolderSource
All Implemented Interfaces:
java.io.Serializable

public class DownloadFolderSource
extends DownloadSource

This class implements a DownloadSource for folder. All files are downloaded from a folder (e.g /usr/local/download).

See Also:
Serialized Form

Field Summary
static int BUFFERSIZE
          Buffer size to read file from disk and write to user's outputstream.
 
Constructor Summary
DownloadFolderSource(java.util.Properties meta)
           
 
Method Summary
 void download(FileInfo fi, java.io.OutputStream outdata)
          Sends file to download (binary) to end-user.
 int getDataLength(FileInfo fi)
          Returns file length or -1 if file is not found or not readable.
 java.util.Vector listFiles(Config c, boolean enablesubfolders)
          List files in folder.
 void recurseList(java.io.File dir, java.util.Vector dirList, boolean recurse)
          Find all files in a given folder and subfolders.
 
Methods inherited from class javazoom.download.DownloadSource
getMeta
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFERSIZE

public static int BUFFERSIZE
Buffer size to read file from disk and write to user's outputstream. Default is 4096

Constructor Detail

DownloadFolderSource

public DownloadFolderSource(java.util.Properties meta)
Method Detail

getDataLength

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

Specified by:
getDataLength in class DownloadSource
Parameters:
fi - FileInfo to download
Returns:
size of file to download.

download

public void download(FileInfo fi,
                     java.io.OutputStream outdata)
              throws java.io.IOException
Sends file to download (binary) to end-user.

Specified by:
download in class DownloadSource
Parameters:
fi - FileInfo to download
outdata - OutputStream for current user.
Throws:
java.io.IOException

listFiles

public java.util.Vector listFiles(Config c,
                                  boolean enablesubfolders)
List files in folder.

Specified by:
listFiles in class DownloadSource
Parameters:
c - Config
enablesubfolders - boolean
Returns:
Vector

recurseList

public void recurseList(java.io.File dir,
                        java.util.Vector dirList,
                        boolean recurse)
Find all files in a given folder and subfolders.

Parameters:
dir - File
dirList - Vector