NASA World Wind

gov.nasa.worldwind.cache
Class AbstractFileCache

java.lang.Object
  extended by gov.nasa.worldwind.cache.AbstractFileCache
All Implemented Interfaces:
FileCache
Direct Known Subclasses:
BasicDataFileCache

public class AbstractFileCache
extends java.lang.Object
implements FileCache


Field Summary
 
Fields inherited from interface gov.nasa.worldwind.cache.FileCache
OS_SPECIFIC_DATA_PATH
 
Constructor Summary
AbstractFileCache()
           
 
Method Summary
 void addCacheLocation(int index, java.lang.String newPath)
           
 void addCacheLocation(java.lang.String newPath)
           
 boolean contains(java.lang.String fileName)
           
 java.net.URL findFile(java.lang.String fileName, boolean checkClassPath)
           
 java.util.List<java.io.File> getCacheLocations()
           
 java.io.File getWriteLocation()
           
protected  void initialize(java.io.InputStream xmlConfigStream)
           
 java.io.File newFile(java.lang.String fileName)
           
 void removeCacheLocation(java.lang.String newPath)
           
 void removeFile(java.net.URL url)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFileCache

public AbstractFileCache()
Method Detail

addCacheLocation

public void addCacheLocation(int index,
                             java.lang.String newPath)
Specified by:
addCacheLocation in interface FileCache

addCacheLocation

public void addCacheLocation(java.lang.String newPath)
Specified by:
addCacheLocation in interface FileCache

contains

public boolean contains(java.lang.String fileName)
Specified by:
contains in interface FileCache

findFile

public java.net.URL findFile(java.lang.String fileName,
                             boolean checkClassPath)
Specified by:
findFile in interface FileCache
Parameters:
fileName - the name of the file to find
checkClassPath - if true, the class path is first searched for the file, otherwise the class path is not searched unless it's one of the explicit paths in the cache search directories
Returns:
a handle to the requested file if it exists in the cache, otherwise null
Throws:
java.lang.IllegalArgumentException - if fileName is null

getCacheLocations

public java.util.List<java.io.File> getCacheLocations()
Specified by:
getCacheLocations in interface FileCache

getWriteLocation

public java.io.File getWriteLocation()
Specified by:
getWriteLocation in interface FileCache

initialize

protected void initialize(java.io.InputStream xmlConfigStream)

newFile

public java.io.File newFile(java.lang.String fileName)
Specified by:
newFile in interface FileCache
Parameters:
fileName - the name to give the newly created file
Returns:
a handle to the newly created file if it could be created and added to the cache, otherwise null
Throws:
java.lang.IllegalArgumentException - if fileName is null

removeCacheLocation

public void removeCacheLocation(java.lang.String newPath)
Specified by:
removeCacheLocation in interface FileCache

removeFile

public void removeFile(java.net.URL url)
Specified by:
removeFile in interface FileCache
Parameters:
url - the "file:" URL of the file to remove from the cache
Throws:
java.lang.IllegalArgumentException - if url is null

NASA World Wind