public class ObjectCollectionSerializer extends Object
The objects passed to this class must therefore be JAXB serializable.
This class is intended to be used in tests that need to persist the state of some object collection.
| Constructor and Description |
|---|
ObjectCollectionSerializer() |
| Modifier and Type | Method and Description |
|---|---|
void |
addObject(Object o) |
void |
addObjects(Collection<?> objects) |
List<?> |
deserialize(InputStream inputStream) |
List<?> |
deserialize(Reader inputReader) |
List<?> |
deserialize(XMLStreamReader reader)
This deserializes given input stream into a list of objects.
|
Set<Class<?>> |
getClasses()
Returns a set of classes of objects that are to be serialized.
|
List<Object> |
getObjects()
Returns a list of objects that are added to this serializer.
|
void |
serialize(OutputStream output)
Serializes the objects added to this serialize to the given output.
|
@NotNull public List<Object> getObjects()
public void addObject(@NotNull
Object o)
public void addObjects(@NotNull
Collection<?> objects)
@NotNull public Set<Class<?>> getClasses()
public void serialize(OutputStream output) throws IOException, JAXBException
output - the output stream to serialize toIOExceptionJAXBExceptionpublic List<?> deserialize(InputStream inputStream) throws IOException, XMLStreamException, ClassNotFoundException, JAXBException
public List<?> deserialize(Reader inputReader) throws IOException, XMLStreamException, ClassNotFoundException, JAXBException
public List<?> deserialize(XMLStreamReader reader) throws IOException, XMLStreamException, ClassNotFoundException, JAXBException
This method uses the current thread's context classloader to resolve the classes of the objects to be deserialized if such classloader is set.
inputStream - the input stream to read the data fromXMLStreamExceptionClassNotFoundExceptionJAXBExceptionIOExceptionCopyright © 2008-2013 Red Hat, Inc.. All Rights Reserved.