public final class ChecksummedDataInput extends AbstractDataInput
AbstractDataInput
wrapper that calctulates the CRC in place.
Useful for HintsReader
, for example, where we must verify the CRC, yet don't want
to allocate an extra byte array just that purpose.
In addition to calculating the CRC, allows to enforce a maximim known size. This is needed
so that Mutation.MutationSerializer
doesn't blow up the heap when deserializing a
corrupted sequence by reading a huge corrupted length of bytes via
via ByteBufferUtil.readWithLength(java.io.DataInput)
.DataInputPlus.DataInputStreamPlus
Modifier and Type | Method and Description |
---|---|
int |
bytesRemaining() |
int |
getCrc() |
long |
getPosition() |
long |
getPositionLimit() |
void |
limit(int newLimit) |
int |
read() |
int |
read(byte[] buff,
int offset,
int length) |
void |
resetCrc() |
void |
resetLimit() |
void |
seek(long position) |
static ChecksummedDataInput |
wrap(AbstractDataInput source) |
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes
available, close, mark, markSupported, read, reset, skip
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
readUnsignedVInt, readVInt
public static ChecksummedDataInput wrap(AbstractDataInput source)
public void resetCrc()
public void resetLimit()
public void limit(int newLimit)
public int bytesRemaining()
public int getCrc()
public void seek(long position) throws java.io.IOException
seek
in class AbstractDataInput
java.io.IOException
public long getPosition()
getPosition
in class AbstractDataInput
public long getPositionLimit()
getPositionLimit
in class AbstractDataInput
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] buff, int offset, int length) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
Copyright © 2015 The Apache Software Foundation