javazoom.download.util
Class FileInfo

java.lang.Object
  |
  +--javazoom.download.util.FileInfo

public class FileInfo
extends java.lang.Object

This class provides information about downloaded and downloadable files.
path, filename, urlmapping, content-type, zip, max. download hits, total downloads, total incomplete downloads, login/password for download.


Constructor Summary
FileInfo(java.lang.String path, java.lang.String filename, java.lang.String urlmapping, java.lang.String ContentType, java.lang.String ContentDisposition, boolean enableZip, int maxDownload, java.lang.String login, java.lang.String password)
          Construts a FileInfo.
 
Method Summary
 void addDownload()
          Increases total download counter.
 void addIncompleteDownload()
          Increases total incomplete download counter.
 boolean checkLogin(java.lang.String login)
          Checks login for the file.
 boolean checkPassword(java.lang.String password)
          Checks password for the file.
 java.lang.String getContentDisposition()
          Gets Content-Disposition for the file
 java.lang.String getContentType()
          Gets Content-Type for the file
static java.lang.String getExtension(java.lang.String filenameStr)
          Gets file extension for any filename.
 java.lang.String getFilename()
          Gets filename.
 java.lang.String getFilenameExtension()
          Gets file extension without ".".
 java.lang.String getLogin()
          Gets login that protects file.
 int getMaxDownload()
          Gets maximum download hits allowed for the file.
 java.lang.String getPassword()
          Gets password that protects file.
 java.lang.String getPath()
          Gets path to filename.
 int getTotalDownload()
          Gets total download hits for the file.
 int getTotalIncompleteDownload()
          Gets total incomplete download hits (for instance stopped by end-user) for the file.
 java.lang.String getUrlMapping()
          Gets URL mapping.
 boolean isZipEnabled()
          Gets zip on-the-fly state.
 void resetTotalDownload()
          Cleans total downloads counter.
 void resetTotalIncompleteDownload()
          Cleans total incomplete downloads counter.
 void updateDownload(int n)
          Updates total download counter.
 void updateIncompleteDownload(int n)
          Updates total incomplete download counter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileInfo

public FileInfo(java.lang.String path,
                java.lang.String filename,
                java.lang.String urlmapping,
                java.lang.String ContentType,
                java.lang.String ContentDisposition,
                boolean enableZip,
                int maxDownload,
                java.lang.String login,
                java.lang.String password)
Construts a FileInfo.

Parameters:
path - : Path to file.
filename - : Filename.
urlmapping - : URL mapping to download file.
ContentType - : Content-Type for the file.
enableZip - : Enable ZIP on-the-fly.
maxDownload - : Download limit allowed.
login - : Login to protect the file.
password - : Password to protect the file.
Method Detail

getFilename

public java.lang.String getFilename()
Gets filename.

Returns:
filename.

getPath

public java.lang.String getPath()
Gets path to filename.

Returns:
path.

getUrlMapping

public java.lang.String getUrlMapping()
Gets URL mapping.
For instance : UrlMapping = map.zip for FileName = test.zip means thats http://server.com/download/map.zip will download /usr/download/test.zip
However, http://server.com/download/test.zip will also download the test.zip

Returns:
url mapping.

getFilenameExtension

public java.lang.String getFilenameExtension()
Gets file extension without ".".

Returns:
file extention

getExtension

public static java.lang.String getExtension(java.lang.String filenameStr)
Gets file extension for any filename.

Parameters:
filenameStr - Input filename.
Returns:
file extention.

getLogin

public java.lang.String getLogin()
Gets login that protects file.

Returns:
login

getPassword

public java.lang.String getPassword()
Gets password that protects file.

Returns:
plain password

getMaxDownload

public int getMaxDownload()
Gets maximum download hits allowed for the file.

Returns:
max downloads

getTotalDownload

public int getTotalDownload()
Gets total download hits for the file. This counter is reseted each time the servlet engine is restarted.

Returns:
total downloads

getTotalIncompleteDownload

public int getTotalIncompleteDownload()
Gets total incomplete download hits (for instance stopped by end-user) for the file. This counter is reseted each time the servlet engine is restarted.

Returns:
total downloads

resetTotalDownload

public void resetTotalDownload()
Cleans total downloads counter.


resetTotalIncompleteDownload

public void resetTotalIncompleteDownload()
Cleans total incomplete downloads counter.


addDownload

public void addDownload()
Increases total download counter.


addIncompleteDownload

public void addIncompleteDownload()
Increases total incomplete download counter.


updateDownload

public void updateDownload(int n)
Updates total download counter.


updateIncompleteDownload

public void updateIncompleteDownload(int n)
Updates total incomplete download counter.


checkLogin

public boolean checkLogin(java.lang.String login)
Checks login for the file.

Parameters:
login - to check
Returns:
checked value

checkPassword

public boolean checkPassword(java.lang.String password)
Checks password for the file.

Parameters:
password - to check
Returns:
checked value

getContentType

public java.lang.String getContentType()
Gets Content-Type for the file

Returns:
content-type

getContentDisposition

public java.lang.String getContentDisposition()
Gets Content-Disposition for the file

Returns:
content-disposition

isZipEnabled

public boolean isZipEnabled()
Gets zip on-the-fly state.

Returns:
zip state