public interface ClassCatalog
extends java.io.Closeable
A catalog is used to store class descriptions separately from serialized
objects, to avoid redundantly stored information with each object.
When serialized objects are stored in a database, a StoredClassCatalog
should be used.
This information is used for serialization of class descriptors or
java.io.ObjectStreamClass objects, each of which represents a unique class
format. For each unique format, a unique class ID is assigned by the
catalog. The class ID can then be used in the serialization stream in place
of the full class information. When used with SerialInput
and
SerialOutput
or any of the serial bindings, the use of the catalog
is transparent to the application.
Modifier and Type | Method and Description |
---|---|
void |
close()
Close a catalog database and release any cached resources.
|
java.io.ObjectStreamClass |
getClassFormat(byte[] classID)
Return the ObjectStreamClass for the given class ID.
|
byte[] |
getClassID(java.io.ObjectStreamClass classDesc)
Return the class ID for the current version of the given class
description.
|
java.lang.ClassLoader |
getClassLoader()
Returns the ClassLoader to be used by bindings that use this catalog, or
null if a default class loader should be used.
|
void close() throws DatabaseException
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable
DatabaseException
- if an error occurs closing the catalog
database.byte[] getClassID(java.io.ObjectStreamClass classDesc) throws DatabaseException, java.lang.ClassNotFoundException
getClassFormat(byte[])
.
This function causes a new class ID to be assigned if the class
description has changed.classDesc
- The class description for which to return the
class ID.DatabaseException
- if an error occurs accessing the catalog
database.java.lang.ClassNotFoundException
- if the class does not exist.java.io.ObjectStreamClass getClassFormat(byte[] classID) throws DatabaseException, java.lang.ClassNotFoundException
classID
- The class ID for which to return the class format.DatabaseException
- if an error occurs accessing the catalog
database.java.lang.ClassNotFoundException
- if the class does not exist.java.lang.ClassLoader getClassLoader()
SerialBinding
to load classes whose description is stored in
the catalog.
In BDB JE, the implementation of this method in StoredClassCatalog
returns the ClassLoader property of the catalog
database Environment. This ensures that the Environment's ClassLoader
property is used for loading all user-supplied classes.
Copyright (c) 2002, 2017 Oracle and/or its affiliates. All rights reserved.