@Internal public abstract class VersionedIOReadableWritable extends Object implements IOReadableWritable, Versioned
IOReadableWritable
which allows to differentiate
between serialization versions. Concrete subclasses should typically override the write(DataOutputView)
and read(DataInputView)
, thereby calling super to ensure version
checking.Constructor and Description |
---|
VersionedIOReadableWritable() |
Modifier and Type | Method and Description |
---|---|
int[] |
getCompatibleVersions()
Returns the compatible version values.
|
int |
getReadVersion()
Returns the found serialization version.
|
void |
read(DataInputView in)
Reads the object's internal data from the given data input view.
|
void |
write(DataOutputView out)
Writes the object's internal data to the given data output view.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getVersion
public void write(DataOutputView out) throws IOException
IOReadableWritable
write
in interface IOReadableWritable
out
- the output view to receive the data.IOException
- thrown if any error occurs while writing to the output streampublic void read(DataInputView in) throws IOException
IOReadableWritable
read
in interface IOReadableWritable
in
- the input view to read the data fromIOException
- thrown if any error occurs while reading from the input streampublic int getReadVersion()
public int[] getCompatibleVersions()
By default, the base implementation recognizes only the current version (identified by
Versioned.getVersion()
) as compatible. This method can be used as a hook and may be overridden
to identify more compatible versions.
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.