@NotThreadSafe
public abstract class Streamer
extends Object
Facade to (de)serialize values.
The current implementation uses XStream as back end.
Modifier and Type | Class and Description |
---|---|
static class |
Streamer.Input
Input.
|
static class |
Streamer.Output
Output.
|
static interface |
Streamer.Validated
Validated.
|
Constructor and Description |
---|
Streamer() |
Modifier and Type | Method and Description |
---|---|
Serializable |
fromXML(XMLElement xmlElement)
Returns the serializable represented by an XML element.
|
abstract Streamer.Input |
newInput(File file,
Optional<Charset> charset)
Returns a new input.
|
abstract Streamer.Input |
newInput(InputStream inputStream,
Optional<Charset> charset)
Returns a new input.
|
abstract Streamer.Input |
newInput(Reader reader)
Returns a new input.
|
Streamer.Input |
newInput(XMLDocument xmlDocument)
Returns a new input.
|
abstract Streamer.Input |
newInput(XMLElement parentElement)
Returns a new input.
|
static Streamer |
newInstance()
Returns a new instance.
|
abstract Streamer.Output |
newOutput(File file,
Optional<Charset> charset)
Returns a new output.
|
abstract Streamer.Output |
newOutput(OutputStream outputStream,
Optional<Charset> charset)
Returns a new output.
|
abstract Streamer.Output |
newOutput(Writer writer)
Returns a new output.
|
abstract Streamer.Output |
newOutput(XMLElement parentElement)
Returns a new output.
|
abstract boolean |
setUp(Optional<KeyedGroups> configProperties,
Optional<KeyedValues> moduleProperties)
Sets up this.
|
abstract void |
tearDown()
Tears down what has been set up.
|
XMLElement |
toXML(Serializable serializable)
Returns a serializable as an XML element.
|
@Nonnull @CheckReturnValue public static Streamer newInstance()
@Nullable @CheckReturnValue public Serializable fromXML(@Nonnull XMLElement xmlElement)
xmlElement
- The XML element.@Nonnull @CheckReturnValue public abstract Streamer.Input newInput(@Nonnull Reader reader)
reader
- A reader.@Nonnull @CheckReturnValue public Streamer.Input newInput(@Nonnull XMLDocument xmlDocument)
xmlDocument
- An XML document.@Nonnull @CheckReturnValue public abstract Streamer.Input newInput(@Nonnull XMLElement parentElement)
parentElement
- A parent element.@Nonnull @CheckReturnValue public abstract Streamer.Input newInput(@Nonnull File file, @Nonnull Optional<Charset> charset) throws FileNotFoundException
file
- An input file.charset
- An optional charset.FileNotFoundException
- When the file is not found.@Nonnull @CheckReturnValue public abstract Streamer.Input newInput(@Nonnull InputStream inputStream, @Nonnull Optional<Charset> charset)
inputStream
- An input stream.charset
- An optional charset.@Nonnull @CheckReturnValue public abstract Streamer.Output newOutput(@Nonnull Writer writer)
writer
- A writer.@Nonnull @CheckReturnValue public abstract Streamer.Output newOutput(@Nonnull XMLElement parentElement)
parentElement
- A parent element.@Nonnull @CheckReturnValue public abstract Streamer.Output newOutput(@Nonnull File file, @Nonnull Optional<Charset> charset) throws FileNotFoundException
file
- An output file.charset
- An optional charset.FileNotFoundException
- When the file is not found.@Nonnull @CheckReturnValue public abstract Streamer.Output newOutput(@Nonnull OutputStream outputStream, @Nonnull Optional<Charset> charset)
outputStream
- An output stream.charset
- An optional charset.@CheckReturnValue public abstract boolean setUp(@Nonnull Optional<KeyedGroups> configProperties, @Nonnull Optional<KeyedValues> moduleProperties)
configProperties
- The optional Configuration properties.moduleProperties
- The optional module properties.public abstract void tearDown()
@Nonnull @CheckReturnValue public XMLElement toXML(@Nullable Serializable serializable)
serializable
- The serializable.Copyright © 2003-2019 Serge Brisson. All Rights Reserved.