public interface FileStore extends WWObject
Modifier and Type | Method and Description |
---|---|
void |
addLocation(int index,
java.lang.String newPath,
boolean isInstall)
Adds a location to search when files are requested from the file store and specifies its location in the search
order.
|
void |
addLocation(java.lang.String newPath,
boolean isInstall)
Adds a location to search when files are requested from the file store.
|
boolean |
containsFile(java.lang.String fileName)
Indicates whether the file store contains a specified file.
|
java.net.URL |
findFile(java.lang.String fileName,
boolean checkClassPath)
Searches the file store for a specified file and returns a reference to it if it is.
|
java.lang.String |
getContentType(java.lang.String address)
Returns the content type of a cached file.
|
long |
getExpirationTime(java.lang.String address)
Returns the expiration time of a cached file.
|
java.util.List<? extends java.io.File> |
getLocations()
Returns the locations that the file store will look for files.
|
java.io.File |
getWriteLocation()
Returns the location that additions to the file store are placed.
|
boolean |
isInstallLocation(java.lang.String path)
Indicates whether a specified location is considered an installed-data location and therefore not subject to
automatic removal of its contents.
|
java.lang.String[] |
listAllFileNames(java.lang.String pathName,
FileStoreFilter filter)
Returns an array of strings naming the files discovered under a specified file store path name.
|
java.lang.String[] |
listFileNames(java.lang.String pathName,
FileStoreFilter filter)
Returns an array of strings naming the files discovered directly under a specified file store path name.
|
java.lang.String[] |
listTopFileNames(java.lang.String pathName,
FileStoreFilter filter)
Returns an array of strings naming the files discovered under a specified file store path name.
|
java.io.File |
newFile(java.lang.String fileName)
Creates a new, empty file in the file store.
|
void |
removeFile(java.lang.String address)
Remove an entry from the file store.
|
void |
removeFile(java.net.URL url)
Removes a file from the file store using the URL to the cached file.
|
void |
removeLocation(java.lang.String path)
Remove a specified read location from the file store.
|
java.net.URL |
requestFile(java.lang.String address)
Requests a file.
|
java.net.URL |
requestFile(java.lang.String address,
boolean cacheRemoteFile)
Requests a file and specifies whether to store retrieved files in the cache or in a temporary location.
|
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
onMessage
void addLocation(int index, java.lang.String newPath, boolean isInstall)
index
- the location in the search list at which to add the new location.newPath
- the location to add.isInstall
- indicates whether the location is an installed-data location and therefore not subject to
automatic removal of its contents.java.lang.IllegalArgumentException
- if the specified path is null or empty or the specified index is less than 0.void addLocation(java.lang.String newPath, boolean isInstall)
newPath
- the location to add. If the location already exists in the list of read locations its entry is
removed and a new entry is added to the end of the search list.isInstall
- indicates whether the location is an "installed data" location and therefore not subject to
automatic removal of its contents.java.lang.IllegalArgumentException
- if the specified path is null or empty.boolean containsFile(java.lang.String fileName)
fileName
- the file in question.java.net.URL findFile(java.lang.String fileName, boolean checkClassPath)
fileName
- the file to search for, identified by a path relative to the root of the file store.checkClassPath
- if true, the current classpath is first searched for the file, otherwise the classpath is
not searched.java.lang.IllegalArgumentException
- if the specified path is null.java.lang.String getContentType(java.lang.String address)
address
- the file's address. If null, null is returned.long getExpirationTime(java.lang.String address)
address
- the file's address. If null, zero is returned.java.util.List<? extends java.io.File> getLocations()
java.io.File getWriteLocation()
boolean isInstallLocation(java.lang.String path)
path
- the path in question.java.lang.IllegalArgumentException
- if the specified path is null or empty.java.lang.String[] listAllFileNames(java.lang.String pathName, FileStoreFilter filter)
pathName
- relative path in the file store to search, or null to search the entire file store.filter
- a file filter.java.lang.IllegalArgumentException
- if the filter is null.java.lang.String[] listFileNames(java.lang.String pathName, FileStoreFilter filter)
pathName
- relative path in the file store to search, or null to search the entire file store.filter
- a file filter.java.lang.IllegalArgumentException
- if the filter is null.java.lang.String[] listTopFileNames(java.lang.String pathName, FileStoreFilter filter)
listAllFileNames(String, FileStoreFilter)
, This has the effect of locating the top file name under each branch.
This returns null if the path does not exist in the store. Returned names are relative pointers to a file in the
store; they are not necessarily a file system path.pathName
- relative path in the file store to search, or null to search the entire file store.filter
- a file filter.java.lang.IllegalArgumentException
- if the filter is null.java.io.File newFile(java.lang.String fileName)
If the file store has no write location, the file is not created and null is returned.
fileName
- the name of the file to create.java.lang.IllegalArgumentException
- if the specified path is null.void removeFile(java.lang.String address)
requestFile(String)
. The address
passed to this method must be the same as the address string that was
passed to requestFile
when the file was added.address
- file address of the entry to remove. This must be the same string as was passed to requestFile(String)
.void removeFile(java.net.URL url)
url
- a URL, as returned by findFile(String, boolean)
identifying the file.java.lang.IllegalArgumentException
- if the specified URL is null.void removeLocation(java.lang.String path)
path
- the read location to remove.java.lang.IllegalArgumentException
- if the specified path is null or identifies the current write location.java.net.URL requestFile(java.lang.String address)
URL
to the file. Otherwise if the specified address is a URL to a remote location, this
initiates a request for the file and returns null
. When the request succeeds the file is stored in
the local WorldWind cache and subsequent invocations of this method return a URL to the retrieved file.address
- the file address: either a local file, a URL, or a path relative to the root of the file store.null
.java.lang.IllegalArgumentException
- if the address
is null
.java.net.URL requestFile(java.lang.String address, boolean cacheRemoteFile)
URL
to the
file. Otherwise if the specified address is a URL to a remote location, this initiates a request for the file and
returns null
. When the request succeeds the file is stored either in the local WorldWind cache or
in a temporary location and subsequent invocations of this method return a URL to the retrieved file.
The cacheRemoteFile
parameter specifies whether to store a retrieved remote file in the WorldWind
cache or in a temporary location. This parameter has no effect if the file exists locally. The temporary location
for a retrieved file does not persist between runtime sessions, and subsequent invocations of this method may not
return the same temporary location.
If a remote file is requested multiple times with different values for cacheRemoteFile
, it is
undefined whether the retrieved file is stored in the WorldWind cache or in a temporary location.
address
- the file address: either a local file, a URL, or a path relative to the root of the file
store.cacheRemoteFile
- true
to store remote files in the WorldWind cache, or false
to
store remote files in a temporary location. Has no effect if the address is a local file.null
.java.lang.IllegalArgumentException
- if the address
is null
.