|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectpatterntesting.runtime.io.AbstractSerializer
public abstract class AbstractSerializer
This is the common superclass for all Serializer casses in PatternTesting. This class was introduced to be able to abstract from the used XStream library in the log package. This allows us to declare the xstream library as "optional" in the POM file.
| Constructor Summary | |
|---|---|
AbstractSerializer()
|
|
| Method Summary | |
|---|---|
abstract ObjectInputStream |
createObjectInputStream(InputStream in)
Creates the ObjectInputStream that deserializes a stream of
objects from an InputStream. |
abstract ObjectOutputStream |
createObjectOutputStream(OutputStream out)
Creates the ObjectOutputStream that serializees a stream of
objects to the OutputStream. |
static AbstractSerializer |
getInstance()
This static method returns an instance of the default serializer. |
Object |
load(File file)
Loads a single ojbect from the given file. |
Object |
load(InputStream in)
Loads a single ojbect from the given stream. |
void |
save(Object object,
File file)
Saves a single object to the given file. |
void |
save(Object object,
OutputStream out)
Saves a single object to the given stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractSerializer()
| Method Detail |
|---|
public static AbstractSerializer getInstance()
XStreamSerializer if the xstream library is
detected in the classpath. If not the BinarySerializer (which
requires the serialized objects to be Serializable) will be used
as fallback.
public abstract ObjectInputStream createObjectInputStream(InputStream in)
throws IOException
ObjectInputStream that deserializes a stream of
objects from an InputStream.
in - the input stream
IOException - Signals that an I/O exception has occurred.
public abstract ObjectOutputStream createObjectOutputStream(OutputStream out)
throws IOException
ObjectOutputStream that serializees a stream of
objects to the OutputStream.
out - the output stream
IOException - Signals that an I/O exception has occurred.
public Object load(File file)
throws IOException,
ClassNotFoundException
file - the file
IOException - Signals that an I/O exception has occurred.
ClassNotFoundException - the class not found exception
public Object load(InputStream in)
throws IOException,
ClassNotFoundException
in - the in
IOException - Signals that an I/O exception has occurred.
ClassNotFoundException - the class not found exception
public void save(Object object,
File file)
throws IOException
object - the objectfile - the file
IOException - Signals that an I/O exception has occurred.
public void save(Object object,
OutputStream out)
throws IOException
object - the objectout - the out
IOException - Signals that an I/O exception has occurred.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||