com.randomcoder.download
Class FileSpec

java.lang.Object
  extended by com.randomcoder.download.FileSpec
All Implemented Interfaces:
Serializable, Cloneable, Comparable<FileSpec>

public class FileSpec
extends Object
implements Serializable, Cloneable, Comparable<FileSpec>

JavaBean which holds details for a downloadable file.

 Copyright (c) 2007, Craig Condit. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
 
   * Redistributions of source code must retain the above copyright notice,
     this list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above copyright notice,
     this list of conditions and the following disclaimer in the documentation
     and/or other materials provided with the distribution.
     
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGE.
 

See Also:
Serialized Form

Constructor Summary
FileSpec()
           
 
Method Summary
protected  Object clone()
          Clones this object.
 int compareTo(FileSpec obj)
          Compares this FileSpec to another FileSpec.
 String getDownloadLink()
          Gets the URL where this file may be downloaded.
 String getFileName()
          Gets the name of this file (without path information).
 long getFileSize()
          Gets the file size in bytes, or -1 if unknown.
 String getFileType()
          Gets the type of this file.
 Date getLastModified()
          Gets the last modified date of this file, or null if unknown.
 String getMd5Link()
          Gets the URL where an MD5 checksum of this file may be located, or null if no MD5 checksum is available.
 String getSha1Link()
          Gets the URL where an SHA-1 checksum of this file may be located, or null if no SHA-1 checksum is available.
 void setDownloadLink(String downloadLink)
          Sets the URL where this file may be downloaded.
 void setFileName(String fileName)
          Sets the name of this file (without path information).
 void setFileSize(long fileSize)
          Sets the file size in bytes, or -1 if unknown.
 void setFileType(String fileType)
          Sets the type of this file.
 void setLastModified(Date lastModified)
          Sets the last modified date of this file, or null if unknown.
 void setMd5Link(String md5Link)
          Gets the URL where an MD5 checksum of this file may be located, or null if no MD5 checksum is available.
 void setSha1Link(String sha1Link)
          Gets the URL where an SHA-1 checksum of this file may be located, or null if no SHA-1 checksum is available.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSpec

public FileSpec()
Method Detail

getDownloadLink

public String getDownloadLink()
Gets the URL where this file may be downloaded.

Returns:
download url

setDownloadLink

public void setDownloadLink(String downloadLink)
Sets the URL where this file may be downloaded.

Parameters:
downloadLink - download url

getFileSize

public long getFileSize()
Gets the file size in bytes, or -1 if unknown.

Returns:
file size

setFileSize

public void setFileSize(long fileSize)
Sets the file size in bytes, or -1 if unknown.

Parameters:
fileSize -

getMd5Link

public String getMd5Link()
Gets the URL where an MD5 checksum of this file may be located, or null if no MD5 checksum is available.

Returns:
md5 checksum url

setMd5Link

public void setMd5Link(String md5Link)
Gets the URL where an MD5 checksum of this file may be located, or null if no MD5 checksum is available.

Parameters:
md5Link - md5 checksum url

getSha1Link

public String getSha1Link()
Gets the URL where an SHA-1 checksum of this file may be located, or null if no SHA-1 checksum is available.

Returns:
sha1 checksum url

setSha1Link

public void setSha1Link(String sha1Link)
Gets the URL where an SHA-1 checksum of this file may be located, or null if no SHA-1 checksum is available.

Parameters:
sha1Link - sha1 checksum url

getFileName

public String getFileName()
Gets the name of this file (without path information).

Returns:
file name

setFileName

public void setFileName(String fileName)
Sets the name of this file (without path information).

Parameters:
fileName - file name

getLastModified

public Date getLastModified()
Gets the last modified date of this file, or null if unknown.

Returns:
last modified date

setLastModified

public void setLastModified(Date lastModified)
Sets the last modified date of this file, or null if unknown.

Parameters:
lastModified - last modified date

getFileType

public String getFileType()
Gets the type of this file.

Returns:
file type

setFileType

public void setFileType(String fileType)
Sets the type of this file.

Parameters:
fileType - file type

compareTo

public int compareTo(FileSpec obj)
Compares this FileSpec to another FileSpec.

Specified by:
compareTo in interface Comparable<FileSpec>
Parameters:
obj - FileSpec to compare
Returns:
negative, 0, or positive number depending on if this object is before, equal, or after obj

clone

protected Object clone()
                throws CloneNotSupportedException
Clones this object.

Overrides:
clone in class Object
Throws:
CloneNotSupportedException - never


Copyright © 2006-2010 Craig Condit. All Rights Reserved.