javazoom.download.util
Class FileInfo

java.lang.Object
  extended byjavazoom.download.util.FileInfo
All Implemented Interfaces:
java.io.Serializable

public class FileInfo
extends java.lang.Object
implements java.io.Serializable

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.

See Also:
Serialized Form

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, java.lang.String field)
          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 getContentDispositionHeader()
          Gets Content-Disposition HTTP header.
 java.lang.String getContentType()
          Gets Content-Type for the file
 java.lang.String getCustomField()
          Gets custom field passed from the download URL or the XML file.
static java.lang.String getExtension(java.lang.String filenameStr)
          Gets file extension for any filename.
 java.lang.String getFilename()
          Gets full filename (including relative path for subfolders).
 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.
 java.lang.String getRelativeFilename()
          Return relative filename without subfolders (if any).
 java.lang.String getRelativePath()
          Return relative path for subfolders (if any).
 long getSize()
           
 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 setContentDisposition(java.lang.String cd)
          Set Content-Disposition field.
 void setContentDispositionHeader(java.lang.String cd)
          Set Content-Disposition HTTP header field.
 void setContentType(java.lang.String ct)
          Set Content-Type field.
 void setSize(long size)
           
 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,
                java.lang.String field)
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.
field - : Custom field.
Method Detail

getFilename

public java.lang.String getFilename()
Gets full filename (including relative path for subfolders).

Returns:
filename.

getRelativePath

public java.lang.String getRelativePath()
Return relative path for subfolders (if any).

Returns:
String

getRelativeFilename

public java.lang.String getRelativeFilename()
Return relative filename without subfolders (if any).

Returns:
String

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

getCustomField

public java.lang.String getCustomField()
Gets custom field passed from the download URL or the XML file.

Returns:

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

setContentType

public void setContentType(java.lang.String ct)
Set Content-Type field.

Parameters:
ct - String

setSize

public void setSize(long size)

getSize

public long getSize()

getContentDisposition

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

Returns:
content-dispositionContent

setContentDisposition

public void setContentDisposition(java.lang.String cd)
Set Content-Disposition field.

Parameters:
cd - String

getContentDispositionHeader

public java.lang.String getContentDispositionHeader()
Gets Content-Disposition HTTP header. (For advanced users only)

Returns:
content-disposition header.

setContentDispositionHeader

public void setContentDispositionHeader(java.lang.String cd)
Set Content-Disposition HTTP header field. For instance : "attachment ;filename=MyFile.txt" (for advanced users only)

Parameters:
cd - String

isZipEnabled

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

Returns:
zip state