T
- the object typepublic class DefaultSerialization<T> extends Object implements Serialization<T>
Serialization
using the built-in Java serialization facility.
Clients can inherit this class.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
DefaultSerialization.ObjectSink<T>
An
ObjectOutput adapter implementation of Sink . |
static class |
DefaultSerialization.ObjectSource<T>
An
ObjectInput adapter implementation of Source . |
Constructor and Description |
---|
DefaultSerialization() |
Modifier and Type | Method and Description |
---|---|
protected ObjectInput |
createObjectInput(InputStream stream)
Creates an
ObjectInput object from the InputStream . |
protected ObjectOutput |
createObjectOutput(OutputStream stream)
Creates an
ObjectOutput object from the OutputStream . |
Sink<T> |
createSink(OutputStream stream)
Creates a new
Sink using the OutputStream . |
Source<T> |
createSource(InputStream stream)
Creates a new
Source using the InputStream . |
public Source<T> createSource(InputStream stream) throws IOException, InterruptedException
Serialization
Source
using the InputStream
.createSource
in interface Serialization<T>
stream
- the InputStream
which contains serialized formSource
IOException
- if failed to create a source by I/O errorInterruptedException
- if interrupted while preparing the sourcepublic Sink<T> createSink(OutputStream stream) throws IOException, InterruptedException
Serialization
Sink
using the OutputStream
.createSink
in interface Serialization<T>
stream
- the OutputStream
which contains serialized formSink
IOException
- if failed to create a sink by I/O errorInterruptedException
- if interrupted while preparing the sinkprotected ObjectInput createObjectInput(InputStream stream) throws IOException, InterruptedException
stream
- the source InputStream
ObjectInput
which takes objects from the sourceIOException
- if failed to create ObjectInput
by I/O errorInterruptedException
- if interrupted while preparing ObjectInput
protected ObjectOutput createObjectOutput(OutputStream stream) throws IOException, InterruptedException
ObjectOutput
object from the OutputStream
.
This implementation returns ObjectOutputStream
.stream
- the target OutputStream
ObjectOutput
which puts objects into the targetIOException
- if failed to create ObjectOutput
by I/O errorInterruptedException
- if interrupted while preparing ObjectOutput
Copyright © 2011–2019 Asakusa Framework Team. All rights reserved.