org.apache.cassandra.io.util

## Class RandomAccessReader

- java.lang.Object
- - java.io.InputStream
  - - org.apache.cassandra.io.util.RebufferingInputStream
    - - org.apache.cassandra.io.util.RandomAccessReader

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

    public class RandomAccessReader
    extends RebufferingInputStream
    implements FileDataInput

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.apache.cassandra.io.util.DataInputPlus

`DataInputPlus.DataInputStreamPlus`

### Field Summary

Fields
`static int` `DEFAULT_BUFFER_SIZE`

### Fields inherited from class org.apache.cassandra.io.util.RebufferingInputStream

`buffer`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`int` `available()`
`long` `bytesPastMark()`
`long` `bytesPastMark(DataPosition mark)`
`long` `bytesRemaining()`
`void` `close()`
`protected long` `current()`
`ChannelProxy` `getChannel()`
`double` `getCrcCheckChance()`
`long` `getFilePointer()`
`java.lang.String` `getPath()`
`long` `getPosition()`
`boolean` `isEOF()`
`long` `length()`
`DataPosition` `mark()`
`boolean` `markSupported()`
`static RandomAccessReader` `open(java.io.File file)` Open a RandomAccessReader (not compressed, not mmapped, no read throttling) that will own its channel.
`java.lang.String` `readLine()` Reads a line of text form the current position in this file.
`void` `reBuffer()` Read data from file starting from current currentOffset to populate buffer.
`void` `reset()`
`void` `reset(DataPosition mark)`
`void` `seek(long newPosition)`
`java.lang.String` `toString()`

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

`read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLong, readPrimitiveSlowly, readShort, readUnsignedByte, readUnsignedShort, readUnsignedVInt, readUTF, readVInt, skipBytes`

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

`mark, read, skip`

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

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

### Methods inherited from interface org.apache.cassandra.io.util.DataInputPlus

`readUnsignedVInt, readVInt, skipBytes, skipBytesFully`

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

`readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF`

### Field Detail

#### DEFAULT_BUFFER_SIZE

    public static final int DEFAULT_BUFFER_SIZE

See Also:
  Constant Field Values

### Method Detail

#### reBuffer

    public void reBuffer()

Read data from file starting from current currentOffset to populate buffer.

Specified by:
  `reBuffer` in class `RebufferingInputStream`

#### getFilePointer

    public long getFilePointer()

Specified by:
  `getFilePointer` in interface `FileDataInput`

#### current

    protected long current()

#### getPath

    public java.lang.String getPath()

Specified by:
  `getPath` in interface `FileDataInput`

#### getChannel

    public ChannelProxy getChannel()

#### reset

    public void reset()
               throws java.io.IOException

Overrides:
  `reset` in class `java.io.InputStream`
Throws:
  `java.io.IOException`

#### markSupported

    public boolean markSupported()

Overrides:
  `markSupported` in class `java.io.InputStream`

#### bytesPastMark

    public long bytesPastMark()

#### mark

    public DataPosition mark()

Specified by:
  `mark` in interface `RewindableDataInput`

#### reset

    public void reset(DataPosition mark)

Specified by:
  `reset` in interface `RewindableDataInput`

#### bytesPastMark

    public long bytesPastMark(DataPosition mark)

Specified by:
  `bytesPastMark` in interface `RewindableDataInput`

#### isEOF

    public boolean isEOF()

Specified by:
  `isEOF` in interface `FileDataInput`
Returns:
  true if there is no more data to read

#### bytesRemaining

    public long bytesRemaining()

Specified by:
  `bytesRemaining` in interface `FileDataInput`

#### available

    public int available()
                  throws java.io.IOException

Overrides:
  `available` in class `java.io.InputStream`
Throws:
  `java.io.IOException`

#### close

    public void close()

Specified by:
  `close` in interface `java.io.Closeable`
Specified by:
  `close` in interface `java.lang.AutoCloseable`
Overrides:
  `close` in class `java.io.InputStream`

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### seek

    public void seek(long newPosition)

Specified by:
  `seek` in interface `FileDataInput`

#### 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`
Overrides:
  `readLine` in class `RebufferingInputStream`
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.

#### length

    public long length()

#### getPosition

    public long getPosition()

#### getCrcCheckChance

    public double getCrcCheckChance()

#### open

    public static RandomAccessReader open(java.io.File file)

Open a RandomAccessReader (not compressed, not mmapped, no read throttling) that will own its channel.

Parameters:
  `file` - File to open for reading
Returns:
  new RandomAccessReader that owns the channel opened in this method.