Package org.apache.flink.core.io
Class VersionedIOReadableWritable
- java.lang.Object
-
- org.apache.flink.core.io.VersionedIOReadableWritable
-
- All Implemented Interfaces:
IOReadableWritable,Versioned
- Direct Known Subclasses:
PostVersionedIOReadableWritable
@Internal public abstract class VersionedIOReadableWritable extends Object implements IOReadableWritable, Versioned
This is the abstract base class forIOReadableWritablewhich allows to differentiate between serialization versions. Concrete subclasses should typically override thewrite(DataOutputView)andread(DataInputView), thereby calling super to ensure version checking.
-
-
Constructor Summary
Constructors Constructor Description VersionedIOReadableWritable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<String>getAdditionalDetailsForIncompatibleVersion(int readVersion)int[]getCompatibleVersions()Returns the compatible version values.intgetReadVersion()Returns the found serialization version.voidread(DataInputView in)Reads the object's internal data from the given data input view.voidwrite(DataOutputView out)Writes the object's internal data to the given data output view.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.core.io.Versioned
getVersion
-
-
-
-
Method Detail
-
write
public void write(DataOutputView out) throws IOException
Description copied from interface:IOReadableWritableWrites the object's internal data to the given data output view.- Specified by:
writein interfaceIOReadableWritable- Parameters:
out- the output view to receive the data.- Throws:
IOException- thrown if any error occurs while writing to the output stream
-
read
public void read(DataInputView in) throws IOException
Description copied from interface:IOReadableWritableReads the object's internal data from the given data input view.- Specified by:
readin interfaceIOReadableWritable- Parameters:
in- the input view to read the data from- Throws:
IOException- thrown if any error occurs while reading from the input stream
-
getReadVersion
public int getReadVersion()
Returns the found serialization version. If this instance was not read from serialized bytes but simply instantiated, then the current version is returned.- Returns:
- the read serialization version, or the current version if the instance was not read from bytes.
-
getCompatibleVersions
public int[] getCompatibleVersions()
Returns the compatible version values.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.- Returns:
- an array of integers representing the compatible version values.
-
-