rj.tools.ccscrape
Class URLCache

java.lang.Object
  extended by rj.tools.ccscrape.URLCache

public class URLCache
extends java.lang.Object

Caches the file pointed to by an URL on the local file system. If the URL points to the local file system, bypasses the caching and passes the URL through.

Version:
$Revision: 1.2 $
Author:
Ralph Jocham

Constructor Summary
URLCache(java.net.URL url)
          Creates a new instance with the url of the file to cache
 
Method Summary
 java.io.File getFile()
          Returns a 'local' File
 void release()
          Releases the file from the URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLCache

public URLCache(java.net.URL url)
Creates a new instance with the url of the file to cache

Parameters:
url - to file which can be remote or local; must not be null
Method Detail

getFile

public java.io.File getFile()
                     throws java.io.IOException
Returns a 'local' File

Returns:
a local file containing the data pointed to by the URL. This may be the file itself if the URL already points to a local file, or it may trigger a copy if the URL points to a remote file.
Throws:
java.io.IOException

release

public void release()
Releases the file from the URL. If the URL was remote the local cache will be deleted.



(c) 1999-2005 by Ralph Jocham (rjocham72@netscape.net)
JCSC is released under the terms of the GNU General Public License