Package com.pnfsoftware.jeb.core.dao
Interface IFileDatabase
- All Known Implementing Classes:
JDB2Manager,ProjectFileStore
public interface IFileDatabase
Database of binary blobs. Each entry is identified by a unique key. Two main implementations
exist:
-
-
-
in-memory blogs-
JDB2 file (on-disk) backed database-
Method Summary
Modifier and TypeMethodDescriptionbooleandeleteFile(String key) Delete a file.getDatabaseReader(String key) Get a database record reader.getDatabaseWriter(String key) Get a database record writer.getFileObject(String key) Attempt to get the filesystem object backing this db file entry.getFileReader(String key) Get an input stream reader for low-level reading from a file.getFileWriter(String key) Get an output stream reader for low-level writing to a file.booleanDetermine if the database contains the given file (the file must exist).byte[]Retrieve the contents of a file.booleanStore the contents of a file.
-
Method Details
-
hasFile
Determine if the database contains the given file (the file must exist).- Parameters:
key- file key- Returns:
- presence indicator
-
saveFile
Store the contents of a file.- Parameters:
key- file keydata- file data- Returns:
- success indicator
-
loadFile
Retrieve the contents of a file.- Parameters:
key- file key- Returns:
- file data, null on error
-
deleteFile
Delete a file.- Parameters:
key- file key- Returns:
- success indicator
-
getFileObject
Attempt to get the filesystem object backing this db file entry.This method may not be implemented (e.g. if this database is not backed by on-disk files), in which case the implementation may throw an
UnsupportedOperationException.- Parameters:
key-- Returns:
-
getFileWriter
Get an output stream reader for low-level writing to a file. The client is responsible for closing the stream after usage.This method may not be implemented, in which case the implementation may throw an
UnsupportedOperationException.- Parameters:
key-- Returns:
- Throws:
IOException
-
getFileReader
Get an input stream reader for low-level reading from a file. The client is responsible for closing the stream after usage.This method may not be implemented, in which case the implementation may throw an
UnsupportedOperationException.- Parameters:
key-- Returns:
- Throws:
IOException
-
getDatabaseWriter
Get a database record writer.This method may not be implemented, in which case the implementation may throw an
UnsupportedOperationException.- Parameters:
key-- Returns:
- Throws:
IOException
-
getDatabaseReader
Get a database record reader.This method may not be implemented, in which case the implementation may throw an
UnsupportedOperationException.- Parameters:
key-- Returns:
- Throws:
IOException
-