Package org.apache.cassandra.io.util
Class TeeDataInputPlus
java.lang.Object
org.apache.cassandra.io.util.TeeDataInputPlus
- All Implemented Interfaces:
DataInput,DataInputPlus
DataInput that also stores the raw inputs into an output buffer
This is useful for storing serialized buffers as they are deserialized.
Note: If a non-zero limit is included it is important to for callers to check
isLimitReached()
before using the tee buffer as it could be cropped.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.cassandra.io.util.DataInputPlus
DataInputPlus.DataInputStreamPlus -
Constructor Summary
ConstructorsConstructorDescriptionTeeDataInputPlus(DataInputPlus source, DataOutputPlus teeBuffer) TeeDataInputPlus(DataInputPlus source, DataOutputPlus teeBuffer, long limit) -
Method Summary
Modifier and TypeMethodDescriptionbooleanUsed to detect if the teeBuffer hit the supplied limit.booleanbytereadByte()charreadChar()doublefloatvoidreadFully(byte[] bytes) voidreadFully(byte[] bytes, int offset, int length) intreadInt()readLine()longreadLong()shortintintlongThink hard before opting for an unsigned encoding.readUTF()longreadVInt()Read a 64-bit integer back.intskipBytes(int n) Always skips the requested number of bytes, unless EOF is reachedvoidskipBytesFully(int n) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cassandra.io.util.DataInputPlus
readUnsignedVInt32, readVInt32
-
Constructor Details
-
TeeDataInputPlus
-
TeeDataInputPlus
-
-
Method Details
-
readFully
- Specified by:
readFullyin interfaceDataInput- Throws:
IOException
-
readFully
- Specified by:
readFullyin interfaceDataInput- Throws:
IOException
-
skipBytes
Description copied from interface:DataInputPlusAlways skips the requested number of bytes, unless EOF is reached- Specified by:
skipBytesin interfaceDataInput- Specified by:
skipBytesin interfaceDataInputPlus- Parameters:
n- number of bytes to skip- Returns:
- number of bytes skipped
- Throws:
IOException
-
readBoolean
- Specified by:
readBooleanin interfaceDataInput- Throws:
IOException
-
readByte
- Specified by:
readBytein interfaceDataInput- Throws:
IOException
-
readUnsignedByte
- Specified by:
readUnsignedBytein interfaceDataInput- Throws:
IOException
-
readShort
- Specified by:
readShortin interfaceDataInput- Throws:
IOException
-
readUnsignedShort
- Specified by:
readUnsignedShortin interfaceDataInput- Throws:
IOException
-
readChar
- Specified by:
readCharin interfaceDataInput- Throws:
IOException
-
readInt
- Specified by:
readIntin interfaceDataInput- Throws:
IOException
-
readLong
- Specified by:
readLongin interfaceDataInput- Throws:
IOException
-
readFloat
- Specified by:
readFloatin interfaceDataInput- Throws:
IOException
-
readDouble
- Specified by:
readDoublein interfaceDataInput- Throws:
IOException
-
readLine
- Specified by:
readLinein interfaceDataInput- Throws:
IOException
-
readUTF
- Specified by:
readUTFin interfaceDataInput- Throws:
IOException
-
readVInt
Description copied from interface:DataInputPlusRead a 64-bit integer back. This method assumes it was originally written usingDataOutputPlus.writeVInt(long)or similar that zigzag encodes the vint.- Specified by:
readVIntin interfaceDataInputPlus- Throws:
IOException
-
readUnsignedVInt
Description copied from interface:DataInputPlusThink hard before opting for an unsigned encoding. Is this going to bite someone because some day they might need to pass in a sentinel value using negative numbers? Is the risk worth it to save a few bytes? Signed, not a fan of unsigned values in protocols and formats- Specified by:
readUnsignedVIntin interfaceDataInputPlus- Throws:
IOException
-
skipBytesFully
- Specified by:
skipBytesFullyin interfaceDataInputPlus- Throws:
IOException
-
isLimitReached
public boolean isLimitReached()Used to detect if the teeBuffer hit the supplied limit. If true this means the teeBuffer does not contain the full input.
-