org.apache.cassandra.io.util

## Class AbstractDataInput

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

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

Direct Known Subclasses:
  ByteBufferDataInput, EncodedDataInputStream, MemoryInputStream, RandomAccessReader

    public abstract class AbstractDataInput
    extends java.io.InputStream
    implements java.io.DataInput

### Constructor Summary

Constructors
Constructor and Description
`AbstractDataInput()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`abstract long` `getPosition()`
`abstract long` `getPositionLimit()`
`boolean` `readBoolean()` Reads a boolean from the current position in this file.
`byte` `readByte()` Reads an 8-bit byte from the current position in this file.
`char` `readChar()` Reads a 16-bit character from the current position in this file.
`double` `readDouble()` Reads a 64-bit double from the current position in this file.
`float` `readFloat()` Reads a 32-bit float from the current position in this file.
`void` `readFully(byte[] buffer)` Reads bytes from this file into `buffer`.
`void` `readFully(byte[] buffer, int offset, int count)` Read bytes from this file into `buffer` starting at offset `offset`.
`int` `readInt()` Reads a 32-bit integer from the current position in this file.
`java.lang.String` `readLine()` Reads a line of text form 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` `readUnsignedByte()` Reads an unsigned 8-bit byte from the current position in this file and returns it as an integer.
`int` `readUnsignedShort()` Reads an unsigned 16-bit short from the current position in this file and returns it as an integer.
`java.lang.String` `readUTF()` Reads a string that is encoded in `modified UTF-8` from this file.
`abstract void` `seek(long position)`
`int` `skipBytes(int n)`

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

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

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

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

### Constructor Detail

#### AbstractDataInput

    public AbstractDataInput()

### Method Detail

#### seek

    public abstract void seek(long position)
                       throws java.io.IOException

Throws:
  `java.io.IOException`

#### getPosition

    public abstract long getPosition()

#### getPositionLimit

    public abstract long getPositionLimit()

#### skipBytes

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

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

#### readBoolean

    public final boolean readBoolean()
                              throws java.io.IOException

Reads a boolean from the current position in this file. Blocks until one byte has been read, the end of the file is reached or an exception is thrown.

Specified by:
  `readBoolean` in interface `java.io.DataInput`
Returns:
  the next boolean 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.

#### readByte

    public final byte readByte()
                        throws java.io.IOException

Reads an 8-bit byte from the current position in this file. Blocks until one byte has been read, the end of the file is reached or an exception is thrown.

Specified by:
  `readByte` in interface `java.io.DataInput`
Returns:
  the next signed 8-bit byte 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.

#### readChar

    public final char readChar()
                        throws java.io.IOException

Reads a 16-bit character 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:
  `readChar` in interface `java.io.DataInput`
Returns:
  the next char 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.

#### readDouble

    public final double readDouble()
                            throws java.io.IOException

Reads a 64-bit double 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:
  `readDouble` in interface `java.io.DataInput`
Returns:
  the next double 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.

#### readFloat

    public final float readFloat()
                          throws java.io.IOException

Reads a 32-bit float 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:
  `readFloat` in interface `java.io.DataInput`
Returns:
  the next float 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.

#### readFully

    public void readFully(byte[] buffer)
                   throws java.io.IOException

Reads bytes from this file into `buffer`. Blocks until `buffer.length` number of bytes have been read, the end of the file is reached or an exception is thrown.

Specified by:
  `readFully` in interface `java.io.DataInput`
Parameters:
  `buffer` - the buffer to read bytes into.
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.
  `java.lang.NullPointerException` - if `buffer` is `null`.

#### readFully

    public void readFully(byte[] buffer,
                          int offset,
                          int count)
                   throws java.io.IOException

Read bytes from this file into `buffer` starting at offset `offset`. This method blocks until `count` number of bytes have been read.

Specified by:
  `readFully` in interface `java.io.DataInput`
Parameters:
  `buffer` - the buffer to read bytes into.
  `offset` - the initial position in `buffer` to store the bytes read from this file.
  `count` - the maximum number of bytes to store in `buffer`.
Throws:
  `java.io.EOFException` - if the end of this file is detected.
  `java.lang.IndexOutOfBoundsException` - if `offset < 0` or `count < 0`, or if `offset + count` is greater than the length of `buffer`.
  `java.io.IOException` - if this file is closed or another I/O error occurs.
  `java.lang.NullPointerException` - if `buffer` is `null`.

#### readInt

    public int readInt()
                throws java.io.IOException

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`
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.

#### readLine

    public final java.lang.String readLine()
                                    throws java.io.IOException

Reads a line of text form the current position in this file. A line is represented by zero or more characters followed by `'\n'`, `'\r'`, `"\r\n"` or the end of file marker. The string does not include the line terminating sequence.

Blocks until a line terminating sequence has been read, the end of the file is reached or an exception is thrown.

Specified by:
  `readLine` in interface `java.io.DataInput`
Returns:
  the contents of the line or `null` if no characters have been read before the end of the file has been reached.
Throws:
  `java.io.IOException` - if this file is closed or another I/O error occurs.

#### readLong

    public long readLong()
                  throws java.io.IOException

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`
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.

#### readShort

    public short readShort()
                    throws java.io.IOException

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`
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.

#### readUnsignedByte

    public final int readUnsignedByte()
                               throws java.io.IOException

Reads an unsigned 8-bit byte from the current position in this file and returns it as an integer. Blocks until one byte has been read, the end of the file is reached or an exception is thrown.

Specified by:
  `readUnsignedByte` in interface `java.io.DataInput`
Returns:
  the next unsigned byte 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.

#### readUnsignedShort

    public int readUnsignedShort()
                          throws java.io.IOException

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`
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.

#### readUTF

    public final java.lang.String readUTF()
                                   throws java.io.IOException

Reads a string that is encoded in `modified UTF-8` from this file. The number of bytes that must be read for the complete string is determined by the first two bytes read from the file. Blocks until all required bytes have been read, the end of the file is reached or an exception is thrown.

Specified by:
  `readUTF` in interface `java.io.DataInput`
Returns:
  the next string encoded in `modified UTF-8` 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.
  `java.io.UTFDataFormatException` - if the bytes read cannot be decoded into a character string.