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 MappedFileDataInput

    java.lang.Object
      java.io.InputStream
          org.apache.cassandra.io.util.MappedFileDataInput

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

    public class MappedFileDataInput

extends java.io.InputStream
implements FileDataInput

Constructor Summary
`MappedFileDataInput(java.nio.MappedByteBuffer buffer, java.lang.String filename, long absoluteStartPosition)`
`MappedFileDataInput(java.nio.MappedByteBuffer buffer, java.lang.String filename, long absoluteStartPosition, int position)`

Method Summary
`int` | `bytesPastMark()`
`long` | `getAbsolutePosition()`
`java.lang.String` | `getPath()`
`boolean` | `isEOF()`
`void` | `mark()`
`void` | `mark(int ignored)`
`boolean` | `markSupported()`
`int` | `read()`
`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.
`void` | `reset()`
`int` | `skipBytes(int n)`

Methods inherited from class java.io.InputStream
`available, close, read, read, 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.Closeable
`close`

Constructor Detail

### MappedFileDataInput

    public MappedFileDataInput(java.nio.MappedByteBuffer buffer,
                               java.lang.String filename,
                               long absoluteStartPosition)

### MappedFileDataInput

    public MappedFileDataInput(java.nio.MappedByteBuffer buffer,
                               java.lang.String filename,
                               long absoluteStartPosition,
                               int position)

Method Detail

### getAbsolutePosition

    public long getAbsolutePosition()

  Specified by:
    `getAbsolutePosition` in interface `FileDataInput`

### markSupported

    public boolean markSupported()

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

### mark

    public void mark(int ignored)

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

### reset

    public void reset()
               throws java.io.IOException

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

### mark

    public void mark()

  Specified by:
    `mark` in interface `FileDataInput`

### bytesPastMark

    public int bytesPastMark()

  Specified by:
    `bytesPastMark` in interface `FileDataInput`

### isEOF

    public boolean isEOF()
                  throws java.io.IOException

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

### getPath

    public java.lang.String getPath()

  Specified by:
    `getPath` in interface `FileDataInput`

### read

    public int read()
             throws java.io.IOException

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

### 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 final 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 final 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 final 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 final 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 final 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 final 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.

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 © 2010 The Apache Software Foundation