Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javazoom.download
Class DownloadDatabaseSource

    java.lang.Object
      javazoom.download.DownloadSource
          javazoom.download.DownloadDatabaseSource

All Implemented Interfaces:
  java.io.Serializable

public class DownloadDatabaseSource
extends DownloadSource

This class implements a DownloadSource for database. All files are downloaded from a table.

See Also:
  Serialized Form

Field Summary
`static int` | `BUFFERSIZE` Buffer size to read file from database inputstream and write to user's outputstream.

Constructor Summary
`DownloadDatabaseSource(java.util.Properties meta)` Contructs DownloadDatabaseSource and loads JDBC driver.

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 cnf, boolean enablesubfolders)` List files in folder.

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 database inputstream and write to user's outputstream. Default is 4096

Constructor Detail

### DownloadDatabaseSource

    public DownloadDatabaseSource(java.util.Properties meta)

  Contructs DownloadDatabaseSource and loads JDBC driver.

Method Detail

### getDataLength

    public int getDataLength(FileInfo fi)

  Returns file length or -1 if file is not found or not readable.
  Step 1 : Connects to database
  Step 2 : Runs SQL query to get file's length
  Step 3 : Close database connection

  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.
  Step 1 : Connects to database
  Step 2 : Runs SQL query to get file's content
  Step 3 : Sends file's content to end-user outpustream
  Step 4 : Close database connection

  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 cnf,
                                      boolean enablesubfolders)

  List files in folder.

  Specified by:
    `listFiles` in class `DownloadSource`
  Parameters:
    `cnf` -
  Returns:

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD