public interface Writeable<T> extends StreamableReader<T>
TimeValue
converts the time to nanoseconds for serialization.
TimeValue actually implements Streamable not Writeable but it has
the same contract.
Prefer implementing this interface over implementing Streamable
where possible. Lots of code depends on Streamable
so this isn't always possible.
The fact that this interface extends StreamableReader
should be consider vestigial. Instead of using its
readFrom(StreamInput)
method you should prefer using the Reader interface as a reference to a constructor that takes
StreamInput
. The reasoning behind this is that most "good" readFrom implementations just delegated to such a constructor anyway
and they required an unsightly PROTOTYPE object.Modifier and Type | Interface and Description |
---|---|
static interface |
Writeable.Reader<R>
Reference to a method that can read some object from a stream.
|
Modifier and Type | Method and Description |
---|---|
default T |
readFrom(StreamInput in)
Reads an object of this type from the provided StreamInput.
|
void |
writeTo(StreamOutput out)
Write this into the StreamOutput.
|
void writeTo(StreamOutput out) throws java.io.IOException
java.io.IOException
default T readFrom(StreamInput in) throws java.io.IOException
StreamableReader
readFrom
in interface StreamableReader<T>
java.io.IOException