package org.apache.cassandra.io.util;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.IOException;
public class TrackedDataInputPlus implements DataInputPlus, BytesReadTracker
{
private long bytesRead;
final DataInput source;
public TrackedDataInputPlus(DataInput source)
{
this.source = source;
}
public long getBytesRead()
{
return bytesRead;
}
public void reset(long count)
{
bytesRead = count;
}
public boolean readBoolean() throws IOException
{
boolean bool = source.readBoolean();
bytesRead += 1;
return bool;
}
public byte readByte() throws IOException
{
byte b = source.readByte();
bytesRead += 1;
return b;
}
public char readChar() throws IOException
{
char c = source.readChar();
bytesRead += 2;
return c;
}
public double readDouble() throws IOException
{
double d = source.readDouble();
bytesRead += 8;
return d;
}
public float readFloat() throws IOException
{
float f = source.readFloat();
bytesRead += 4;
return f;
}
public void readFully(byte[] b, int off, int len) throws IOException
{
source.readFully(b, off, len);
bytesRead += len;
}
public void readFully(byte[] b) throws IOException
{
source.readFully(b);
bytesRead += b.length;
}
public int readInt() throws IOException
{
int i = source.readInt();
bytesRead += 4;
return i;
}
public String readLine() throws IOException
{
throw new UnsupportedOperationException();
}
public long readLong() throws IOException
{
long l = source.readLong();
bytesRead += 8;
return l;
}
public short readShort() throws IOException
{
short s = source.readShort();
bytesRead += 2;
return s;
}
public String readUTF() throws IOException
{
return DataInputStream.readUTF(this);
}
public int readUnsignedByte() throws IOException
{
int i = source.readUnsignedByte();
bytesRead += 1;
return i;
}
public int readUnsignedShort() throws IOException
{
int i = source.readUnsignedShort();
bytesRead += 2;
return i;
}
public int skipBytes(int n) throws IOException
{
int skipped = source.skipBytes(n);
bytesRead += skipped;
return skipped;
}
}