RandomAccessReader (apache-cassandra API)
Date: 2012-05-04

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cassandra.io.util
Class RandomAccessReader

    java.lang.Object
      java.io.RandomAccessFile
          org.apache.cassandra.io.util.RandomAccessReader

All Implemented Interfaces:
  java.io.Closeable, java.io.DataInput, java.io.DataOutput, FileDataInput

Direct Known Subclasses:
  CompressedRandomAccessReader

    public class RandomAccessReader

extends java.io.RandomAccessFile
implements FileDataInput

Nested Class Summary
`protected static class` | `RandomAccessReader.BufferedRandomAccessFileMark` Class to hold a mark to the position of the file

Field Summary
`protected byte[]` | `buffer`
`protected long` | `bufferOffset`
`protected java.nio.channels.FileChannel` | `channel`
`protected long` | `current`
`static int` | `DEFAULT_BUFFER_SIZE`
`protected long` | `markedPointer`
`static long` | `MAX_BYTES_IN_PAGE_CACHE`
`protected int` | `validBufferBytes`

Constructor Summary
`RandomAccessReader(java.io.File file, int bufferSize, boolean skipIOCache)`

Method Summary
`protected int` | `bufferCursor()`
`long` | `bytesPastMark()`
`long` | `bytesPastMark(FileMark mark)`
`long` | `bytesRemaining()`
`void` | `close()`
`long` | `getFilePointer()`
`java.lang.String` | `getPath()`
`boolean` | `isEOF()`
`long` | `length()`
`FileMark` | `mark()`
`static RandomAccessReader` | `open(java.io.File file)`
`static RandomAccessReader` | `open(java.io.File file, boolean skipIOCache)`
`static RandomAccessReader` | `open(java.io.File file, int bufferSize)`
`static RandomAccessReader` | `open(java.io.File file, int bufferSize, boolean skipIOCache)`
`static RandomAccessReader` | `open(SequentialWriter writer)`
`int` | `read()`
`int` | `read(byte[] buffer)`
`int` | `read(byte[] buff, int offset, int length)`
`java.nio.ByteBuffer` | `readBytes(int length)` Read length bytes from current file position
`protected void` | `reBuffer()` Read data from file starting from current currentOffset to populate buffer.
`void` | `reset()`
`void` | `reset(FileMark mark)`
`protected void` | `resetBuffer()`
`void` | `seek(long newPosition)`
`java.lang.String` | `toString()`
`void` | `write(byte[] buffer)`
`void` | `write(byte[] buffer, int offset, int length)`
`void` | `write(int value)`

Methods inherited from class java.io.RandomAccessFile
`getChannel, getFD, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, setLength, skipBytes, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.io.DataInput
`readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes`

Field Detail

### MAX_BYTES_IN_PAGE_CACHE

    public static final long MAX_BYTES_IN_PAGE_CACHE

### DEFAULT_BUFFER_SIZE

    public static final int DEFAULT_BUFFER_SIZE

See Also:
  Constant Field Values

### buffer

    protected byte[] buffer

### bufferOffset

    protected long bufferOffset

### current

    protected long current

### markedPointer

    protected long markedPointer

### validBufferBytes

    protected int validBufferBytes

### channel

    protected final java.nio.channels.FileChannel channel

Constructor Detail

### RandomAccessReader

    public RandomAccessReader(java.io.File file,
                              int bufferSize,
                              boolean skipIOCache)
                       throws java.io.IOException

Throws:
  `java.io.IOException`

Method Detail

### open

    public static RandomAccessReader open(java.io.File file,
                                          boolean skipIOCache)
                                   throws java.io.IOException

  Throws:
    `java.io.IOException`

### open

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

  Throws:
    `java.io.IOException`

### open

    public static RandomAccessReader open(java.io.File file,
                                          int bufferSize)
                                   throws java.io.IOException

  Throws:
    `java.io.IOException`

### open

    public static RandomAccessReader open(java.io.File file,
                                          int bufferSize,
                                          boolean skipIOCache)
                                   throws java.io.IOException

  Throws:
    `java.io.IOException`

### open

    public static RandomAccessReader open(SequentialWriter writer)
                                   throws java.io.IOException

  Throws:
    `java.io.IOException`

### reBuffer

    protected void reBuffer()
                     throws java.io.IOException

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

  Throws:
    `java.io.IOException` - on any I/O error.

### getFilePointer

    public long getFilePointer()

  Overrides:
    `getFilePointer` in class `java.io.RandomAccessFile`

### getPath

    public java.lang.String getPath()

  Specified by:
    `getPath` in interface `FileDataInput`

### reset

    public void reset()
               throws java.io.IOException

  Throws:
    `java.io.IOException`

### bytesPastMark

    public long bytesPastMark()

### mark

    public FileMark mark()

  Specified by:
    `mark` in interface `FileDataInput`

### reset

    public void reset(FileMark mark)
               throws java.io.IOException

  Specified by:
    `reset` in interface `FileDataInput`
  Throws:
    `java.io.IOException`

### bytesPastMark

    public long bytesPastMark(FileMark mark)

  Specified by:
    `bytesPastMark` in interface `FileDataInput`

### isEOF

    public boolean isEOF()
                  throws java.io.IOException

  Specified by:
    `isEOF` in interface `FileDataInput`
  Returns:
    true if there is no more data to read
  Throws:
    `java.io.IOException` - on any I/O error.

### bytesRemaining

    public long bytesRemaining()
                        throws java.io.IOException

  Specified by:
    `bytesRemaining` in interface `FileDataInput`
  Throws:
    `java.io.IOException`

### bufferCursor

    protected int bufferCursor()

### resetBuffer

    protected void resetBuffer()

### close

    public void close()
               throws java.io.IOException

  Specified by:
    `close` in interface `java.io.Closeable`
  Overrides:
    `close` in class `java.io.RandomAccessFile`
  Throws:
    `java.io.IOException`

### toString

    public java.lang.String toString()

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

### seek

    public void seek(long newPosition)
              throws java.io.IOException

  Overrides:
    `seek` in class `java.io.RandomAccessFile`
  Throws:
    `java.io.IOException`

### read

    public int read()
             throws java.io.IOException

  Overrides:
    `read` in class `java.io.RandomAccessFile`
  Throws:
    `java.io.IOException`

### read

    public int read(byte[] buffer)
             throws java.io.IOException

  Overrides:
    `read` in class `java.io.RandomAccessFile`
  Throws:
    `java.io.IOException`

### read

    public int read(byte[] buff,
                    int offset,
                    int length)
             throws java.io.IOException

  Overrides:
    `read` in class `java.io.RandomAccessFile`
  Throws:
    `java.io.IOException`

### readBytes

    public java.nio.ByteBuffer readBytes(int length)
                                  throws java.io.IOException

  Description copied from interface: `FileDataInput`
  Read length bytes from current file position

  Specified by:
    `readBytes` in interface `FileDataInput`
  Parameters:
    `length` - length of the bytes to read
  Returns:
    buffer with bytes read
  Throws:
    `java.io.IOException` - if any I/O operation failed

### length

    public long length()
                throws java.io.IOException

  Overrides:
    `length` in class `java.io.RandomAccessFile`
  Throws:
    `java.io.IOException`

### write

    public void write(int value)
               throws java.io.IOException

  Specified by:
    `write` in interface `java.io.DataOutput`
  Overrides:
    `write` in class `java.io.RandomAccessFile`
  Throws:
    `java.io.IOException`

### write

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

  Specified by:
    `write` in interface `java.io.DataOutput`
  Overrides:
    `write` in class `java.io.RandomAccessFile`
  Throws:
    `java.io.IOException`

### write

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

  Specified by:
    `write` in interface `java.io.DataOutput`
  Overrides:
    `write` in class `java.io.RandomAccessFile`
  Throws:
    `java.io.IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012 The Apache Software Foundation