Package VASSAL.tools.io
Interface FileStore
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
ImageTileDiskCache
An interface for providing read access to files.
- Since:
- 3.2.0
- Author:
- Joel Uckelman
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the store.boolean
Queries whether a file exists in the store.getFiles()
Gets the list of files in the store.Gets the list of files under a given directory of the store.getInputStream
(String path) Gets anInputStream
to read from the given file.long
Gets the modification time of a file in the store, in milliseconds since the epoch.long
Gets the size of a file in the store, in bytes.boolean
isClosed()
Checks whether the store is closed.
-
Method Details
-
contains
Queries whether a file exists in the store.- Parameters:
path
- the path to the file in the store- Returns:
true
if the file exists in the store- Throws:
IOException
- oops
-
getInputStream
Gets anInputStream
to read from the given file.- Parameters:
path
- the path to the file in the store- Returns:
- an
InputStream
containing the requested file - Throws:
IOException
- oops
-
getSize
Gets the size of a file in the store, in bytes.- Parameters:
path
- the path to the file in the store- Returns:
- the size of the file, in bytes
- Throws:
FileNotFoundException
- ifpath
is not in the storeIOException
- oops
-
getMTime
Gets the modification time of a file in the store, in milliseconds since the epoch.- Parameters:
path
- the path to the file in the store- Returns:
- the mtime of the file
- Throws:
FileNotFoundException
- ifpath
is not in the storeIOException
- oops
-
getFiles
Gets the list of files in the store.- Returns:
- the list of files in the store
- Throws:
IOException
- oops
-
getFiles
Gets the list of files under a given directory of the store.- Parameters:
root
- the directory- Returns:
- the list of files under the given directory
- Throws:
FileNotFoundException
- ifroot
is not in the storeIOException
- oops
-
close
Closes the store.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
- oops
-
isClosed
boolean isClosed()Checks whether the store is closed.- Returns:
true
if the archive is closed
-