@Internal public abstract class PostVersionedIOReadableWritable extends VersionedIOReadableWritable
VersionedIOReadableWritable
which allows to differentiate whether the previous
data was versioned with a VersionedIOReadableWritable
. This can be used if previously
written data was not versioned, and is to be migrated to a versioned format.Constructor and Description |
---|
PostVersionedIOReadableWritable() |
Modifier and Type | Method and Description |
---|---|
void |
read(DataInputView in)
We do not support reading from a
DataInputView , because it does not
support pushing back already read bytes. |
protected abstract void |
read(DataInputView in,
boolean wasVersioned)
Read from the provided
in . |
void |
read(InputStream inputStream)
This read attempts to first identify if the input view contains the special
VERSIONED_IDENTIFIER by reading and buffering the first few bytes. |
void |
write(DataOutputView out)
Writes the object's internal data to the given data output view.
|
getCompatibleVersions, getReadVersion
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getVersion
protected abstract void read(DataInputView in, boolean wasVersioned) throws IOException
in
. A flag wasVersioned
can be
used to determine whether or not the data to read was previously written
by a VersionedIOReadableWritable
.IOException
public void write(DataOutputView out) throws IOException
IOReadableWritable
write
in interface IOReadableWritable
write
in class VersionedIOReadableWritable
out
- the output view to receive the data.IOException
- thrown if any error occurs while writing to the output streampublic final void read(InputStream inputStream) throws IOException
VERSIONED_IDENTIFIER
by reading and buffering the first few bytes.
If identified to be versioned, the usual version resolution read path
in VersionedIOReadableWritable.read(DataInputView)
is invoked.
Otherwise, we "reset" the input stream by pushing back the read buffered bytes
into the stream.IOException
public final void read(DataInputView in) throws IOException
DataInputView
, because it does not
support pushing back already read bytes.read
in interface IOReadableWritable
read
in class VersionedIOReadableWritable
in
- the input view to read the data fromIOException
- thrown if any error occurs while reading from the input streamCopyright © 2014–2018 The Apache Software Foundation. All rights reserved.