Package noaa.coastwatch.io
Class SerializedObjectManager
java.lang.Object
noaa.coastwatch.io.SerializedObjectManager
The
SerializedObjectManager
class can be used to save,
load, delete, and get a list of serialized objects. The objects
are stored as GZIP compressed files in a user-specified directory.- Since:
- 3.1.7
- Author:
- Peter Hollemans
-
Constructor Summary
ConstructorDescriptionSerializedObjectManager
(File objectDir) Creates a new manager to handle serialized objects in the specified directory. -
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteObject
(String objectName) Deletes the specified object.Gets the list of object names available.loadObject
(String objectName) Loads the specified serialized object.void
saveObject
(Object object, String objectName) Serializes and saves the specified object.
-
Constructor Details
-
SerializedObjectManager
Creates a new manager to handle serialized objects in the specified directory.- Parameters:
objectDir
- the directory used to perform all serialized object operations.
-
-
Method Details
-
getObjectNames
Gets the list of object names available. -
loadObject
Loads the specified serialized object.- Parameters:
objectName
- the object name, which must be a valid name obtained from thegetObjectNames()
method.- Returns:
- the deserialized object read.
- Throws:
IOException
- if an error occurred reading the object file.ClassNotFoundException
- if the object class read is unknown.
-
saveObject
Serializes and saves the specified object.- Parameters:
object
- the object to save.objectName
- the object name. This is the name that may be used later to retrieve the object.- Throws:
IOException
- if an error occurred writing the object file.
-
deleteObject
Deletes the specified object. A subsequent call togetObjectNames()
will not include thie specified name in the list.- Throws:
IOException
- if an error occurred deleting the object file.
-