Package org.apache.cassandra.io.util
Class TrackedDataInputPlus
- java.lang.Object
-
- org.apache.cassandra.io.util.TrackedDataInputPlus
-
- All Implemented Interfaces:
java.io.DataInput
,BytesReadTracker
,DataInputPlus
public class TrackedDataInputPlus extends java.lang.Object implements DataInputPlus, BytesReadTracker
This class is to track bytes read from given DataInput
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.cassandra.io.util.DataInputPlus
DataInputPlus.DataInputStreamPlus
-
-
Constructor Summary
Constructors Constructor Description TrackedDataInputPlus(java.io.DataInput source)
Create a TrackedDataInputPlus from given DataInput with no limit of bytes to readTrackedDataInputPlus(java.io.DataInput source, long limit)
Create a TrackedDataInputPlus from given DataInput with limit of bytes to read.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getBytesRead()
boolean
readBoolean()
byte
readByte()
char
readChar()
double
readDouble()
float
readFloat()
void
readFully(byte[] b)
void
readFully(byte[] b, int off, int len)
int
readInt()
java.lang.String
readLine()
long
readLong()
short
readShort()
int
readUnsignedByte()
int
readUnsignedShort()
java.lang.String
readUTF()
void
reset(long count)
reset counter to @param countint
skipBytes(int n)
Always skips the requested number of bytes, unless EOF is reached-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.io.util.DataInputPlus
readUnsignedVInt, readUnsignedVInt32, readVInt, readVInt32, skipBytesFully
-
-
-
-
Constructor Detail
-
TrackedDataInputPlus
public TrackedDataInputPlus(java.io.DataInput source)
Create a TrackedDataInputPlus from given DataInput with no limit of bytes to read
-
TrackedDataInputPlus
public TrackedDataInputPlus(java.io.DataInput source, long limit)
Create a TrackedDataInputPlus from given DataInput with limit of bytes to read. If limit is reachedIOException
will be thrown when trying to read more bytes.
-
-
Method Detail
-
getBytesRead
public long getBytesRead()
- Specified by:
getBytesRead
in interfaceBytesReadTracker
-
reset
public void reset(long count)
reset counter to @param count- Specified by:
reset
in interfaceBytesReadTracker
-
readBoolean
public boolean readBoolean() throws java.io.IOException
- Specified by:
readBoolean
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readByte
public byte readByte() throws java.io.IOException
- Specified by:
readByte
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readChar
public char readChar() throws java.io.IOException
- Specified by:
readChar
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readDouble
public double readDouble() throws java.io.IOException
- Specified by:
readDouble
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readFloat
public float readFloat() throws java.io.IOException
- Specified by:
readFloat
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readFully
public void readFully(byte[] b, int off, int len) throws java.io.IOException
- Specified by:
readFully
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readFully
public void readFully(byte[] b) throws java.io.IOException
- Specified by:
readFully
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readInt
public int readInt() throws java.io.IOException
- Specified by:
readInt
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readLine
public java.lang.String readLine() throws java.io.IOException
- Specified by:
readLine
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readLong
public long readLong() throws java.io.IOException
- Specified by:
readLong
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readShort
public short readShort() throws java.io.IOException
- Specified by:
readShort
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readUTF
public java.lang.String readUTF() throws java.io.IOException
- Specified by:
readUTF
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readUnsignedByte
public int readUnsignedByte() throws java.io.IOException
- Specified by:
readUnsignedByte
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readUnsignedShort
public int readUnsignedShort() throws java.io.IOException
- Specified by:
readUnsignedShort
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
skipBytes
public int skipBytes(int n) throws java.io.IOException
Description copied from interface:DataInputPlus
Always skips the requested number of bytes, unless EOF is reached- Specified by:
skipBytes
in interfacejava.io.DataInput
- Specified by:
skipBytes
in interfaceDataInputPlus
- Parameters:
n
- number of bytes to skip- Returns:
- number of bytes skipped
- Throws:
java.io.IOException
-
-