@PublicEvolving 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 |
---|---|
boolean |
isCompatibleVersion(int version)
Checks for compatibility between this and the found version.
|
void |
read(DataInputView in)
Reads the object's internal data from the given data input view.
|
protected void |
resolveVersionRead(int foundVersion)
This method is a hook to react on the version tag that we find during read.
|
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 streamprotected void resolveVersionRead(int foundVersion) throws VersionMismatchException
foundVersion
- the version found from reading the input streamVersionMismatchException
- thrown when serialization versions mismatchpublic boolean isCompatibleVersion(int version)
version
- version number to compare against.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.