org.apache.cassandra.utils.vint

## Class EncodedDataInputStream

- java.lang.Object
- - java.io.InputStream
  - - org.apache.cassandra.io.util.AbstractDataInput
    - - org.apache.cassandra.utils.vint.EncodedDataInputStream

All Implemented Interfaces:
  java.io.Closeable, java.io.DataInput, java.lang.AutoCloseable

    public class EncodedDataInputStream
    extends AbstractDataInput
    implements java.io.DataInput

Borrows idea from https://developers.google.com/protocol-buffers/docs/encoding#varints Should be used with EncodedDataOutputStream

### Constructor Summary

Constructors
Constructor and Description
`EncodedDataInputStream(java.io.DataInput input)`

### Method Summary

All Methods Instance Methods Concrete Methods
`long` `getPosition()`
`long` `getPositionLimit()`
`protected long` `length()`
`int` `read()`
`int` `readInt()` Reads a 32-bit integer from the current position in this file.
`long` `readLong()` Reads a 64-bit long from the current position in this file.
`short` `readShort()` Reads a 16-bit short from the current position in this file.
`int` `readUnsignedShort()` Reads an unsigned 16-bit short from the current position in this file and returns it as an integer.
`void` `seek(long position)`
`int` `skipBytes(int n)`

### Methods inherited from class org.apache.cassandra.io.util.AbstractDataInput

`readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readLine, readUnsignedByte, readUTF`

### Methods inherited from class java.io.InputStream

`available, close, mark, markSupported, read, read, reset, skip`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface java.io.DataInput

`readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readLine, readUnsignedByte, readUTF`

### Constructor Detail

#### EncodedDataInputStream

    public EncodedDataInputStream(java.io.DataInput input)

### Method Detail

#### skipBytes

    public int skipBytes(int n)
                  throws java.io.IOException

Specified by:
  `skipBytes` in interface `java.io.DataInput`
Overrides:
  `skipBytes` in class `AbstractDataInput`
Throws:
  `java.io.IOException`

#### read

    public int read()
             throws java.io.IOException

Specified by:
  `read` in class `java.io.InputStream`
Throws:
  `java.io.IOException`

#### seek

    public void seek(long position)

Specified by:
  `seek` in class `AbstractDataInput`

#### getPosition

    public long getPosition()

Specified by:
  `getPosition` in class `AbstractDataInput`

#### getPositionLimit

    public long getPositionLimit()

Specified by:
  `getPositionLimit` in class `AbstractDataInput`

#### length

    protected long length()

#### readInt

    public int readInt()
                throws java.io.IOException

Description copied from class: `AbstractDataInput`
Reads a 32-bit integer from the current position in this file. Blocks until four bytes have been read, the end of the file is reached or an exception is thrown.

Specified by:
  `readInt` in interface `java.io.DataInput`
Overrides:
  `readInt` in class `AbstractDataInput`
Returns:
  the next int value from this file.
Throws:
  `java.io.EOFException` - if the end of this file is detected.
  `java.io.IOException` - if this file is closed or another I/O error occurs.

#### readLong

    public long readLong()
                  throws java.io.IOException

Description copied from class: `AbstractDataInput`
Reads a 64-bit long from the current position in this file. Blocks until eight bytes have been read, the end of the file is reached or an exception is thrown.

Specified by:
  `readLong` in interface `java.io.DataInput`
Overrides:
  `readLong` in class `AbstractDataInput`
Returns:
  the next long value from this file.
Throws:
  `java.io.EOFException` - if the end of this file is detected.
  `java.io.IOException` - if this file is closed or another I/O error occurs.

#### readUnsignedShort

    public int readUnsignedShort()
                          throws java.io.IOException

Description copied from class: `AbstractDataInput`
Reads an unsigned 16-bit short from the current position in this file and returns it as an integer. Blocks until two bytes have been read, the end of the file is reached or an exception is thrown.

Specified by:
  `readUnsignedShort` in interface `java.io.DataInput`
Overrides:
  `readUnsignedShort` in class `AbstractDataInput`
Returns:
  the next unsigned short value from this file as an int.
Throws:
  `java.io.EOFException` - if the end of this file is detected.
  `java.io.IOException` - if this file is closed or another I/O error occurs.

#### readShort

    public short readShort()
                    throws java.io.IOException

Description copied from class: `AbstractDataInput`
Reads a 16-bit short from the current position in this file. Blocks until two bytes have been read, the end of the file is reached or an exception is thrown.

Specified by:
  `readShort` in interface `java.io.DataInput`
Overrides:
  `readShort` in class `AbstractDataInput`
Returns:
  the next short value from this file.
Throws:
  `java.io.EOFException` - if the end of this file is detected.
  `java.io.IOException` - if this file is closed or another I/O error occurs.