org.jurvis.util
Class JvDefaultFileFetcher

java.lang.Object
  extended by org.jurvis.util.JvDefaultFileFetcher
All Implemented Interfaces:
ActionListener, EventListener, JvFileFetcher

public class JvDefaultFileFetcher
extends Object
implements JvFileFetcher, ActionListener

Default JvFileFetcher that uses the standard Java I/O classes.

Author:
Neil W. Weber

Field Summary
protected  int bytes
           
protected  JvCachedFile cachedFile
           
protected  long contentLength
           
protected  String etag
           
protected  long expires
           
protected  long fetchStarted
           
protected  long lastModified
           
protected  long lastUpdate
           
protected  JvDataTransferModel transferModel
           
 
Constructor Summary
JvDefaultFileFetcher(JvCachedFile cachedFile)
          Construct a new JvDefaultFileFetcher.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Method called when the timer fires.
 void fetch(File dest, JvDataTransferModel transferModel)
          Fetch the file and notify transferModel of the progress.
 long getContentLength()
          Return the size of the downloaded file.
 String getEtag()
          Return the Etag that identifies the file.
 long getExpires()
          Return the date the cached file should expire.
 long getLastModified()
          Return the last modified date of the file.
protected  InputStream open()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

transferModel

protected JvDataTransferModel transferModel

cachedFile

protected JvCachedFile cachedFile

contentLength

protected long contentLength

lastModified

protected long lastModified

expires

protected long expires

etag

protected String etag

fetchStarted

protected long fetchStarted

lastUpdate

protected long lastUpdate

bytes

protected int bytes
Constructor Detail

JvDefaultFileFetcher

public JvDefaultFileFetcher(JvCachedFile cachedFile)
Construct a new JvDefaultFileFetcher.

Parameters:
cachedFile - cache entry for the file to be fetched
Method Detail

getContentLength

public long getContentLength()
Return the size of the downloaded file.

Specified by:
getContentLength in interface JvFileFetcher

getLastModified

public long getLastModified()
Return the last modified date of the file.

Specified by:
getLastModified in interface JvFileFetcher

getExpires

public long getExpires()
Return the date the cached file should expire. Returns 0 if the file shouldn't be cached.

Specified by:
getExpires in interface JvFileFetcher

getEtag

public String getEtag()
Return the Etag that identifies the file. Returns null if one isn't available.

Specified by:
getEtag in interface JvFileFetcher

fetch

public void fetch(File dest,
                  JvDataTransferModel transferModel)
           throws IOException
Fetch the file and notify transferModel of the progress.

Specified by:
fetch in interface JvFileFetcher
Parameters:
dest - the cache entry
transferModel - object holding status of the transfer; may be null
Throws:
IOException

open

protected InputStream open()
                    throws IOException
Throws:
IOException

actionPerformed

public void actionPerformed(ActionEvent e)
Method called when the timer fires.

Specified by:
actionPerformed in interface ActionListener


Copyright © 1999-2004 Neil W. Weber. All Rights Reserved.