T - public class Serializer<T extends Serializable> extends Object
| Constructor and Description |
|---|
Serializer()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
<E extends T> |
read(File file,
Object... args)
Loads an object from the persistent storage.
|
<E extends T> |
read(InputStream in,
Object... args)
Loads an object from the persistent storage.
|
void |
readError(Exception xany,
String msg)
Called when an error occurs during read.
|
void |
readWarning(Exception xany,
String msg)
Called when a warning occurs during read.
|
<E extends T> |
write(File file,
E persist,
Object... args)
Saves an object to persistent storage.
|
<E extends T> |
write(OutputStream out,
E persist,
Object... args)
Saves an object to persistent storage.
|
void |
writeError(Exception xany,
String msg)
Called when an error occurs during write.
|
void |
writeWarning(Exception xany,
String msg)
Called when an error occurs during write.
|
public void readError(Exception xany, String msg)
Default is to throw a ProxyException.
xany - an exceptionmsg - the messagepublic void readWarning(Exception xany, String msg)
Default is to log a warning through the SerializationProxy logger.
xany - an exceptionmsg - the messagepublic void writeError(Exception xany, String msg)
Default is to throw a ProxyException.
xany - an exceptionmsg - the messagepublic void writeWarning(Exception xany, String msg)
Default is to log a warning through the SerializationProxy logger.
xany - an exceptionmsg - the messagepublic final <E extends T> boolean write(File file, E persist, Object... args)
E - the class of the object to persistfile - the file to write to; it will be created if it does not exist, overwritten otherwisepersist - the object to serializeargs - the proxy argumentsSerializationProxy.ProxyException - in case of low level errorpublic final <E extends T> boolean write(OutputStream out, E persist, Object... args)
E - the class of the object to persistout - the stream to write topersist - the object to serializeargs - the proxy argumentsSerializationProxy.ProxyException - in case of low level errorpublic final <E extends T> E read(File file, Object... args)
E - the class of the object to readfile - the file to read fromargs - the proxy argumentsSerializationProxy.ProxyException - in case of low level errorpublic final <E extends T> E read(InputStream in, Object... args)
E - the class of the object to readin - the stream to read fromargs - the proxy argumentsSerializationProxy.ProxyException - in case of low level errorCopyright © 2024 The Apache Software Foundation. All rights reserved.