org.apache.cassandra.io.util

## Class ByteBufferDataInput

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

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

      public class ByteBufferDataInput
      extends AbstractDataInput
      implements FileDataInput, java.io.DataInput

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ByteBufferDataInput(java.nio.ByteBuffer buffer, java.lang.String filename, long segmentOffset, int position)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `bytesPastMark(FileMark mark)`
    `long` | `bytesRemaining()`
    `long` | `getFilePointer()`
    `java.lang.String` | `getPath()`
    `long` | `getPosition()`
    `long` | `getPositionLimit()`
    `boolean` | `isEOF()`
    `FileMark` | `mark()`
    `boolean` | `markSupported()`
    `int` | `read()`
    `java.nio.ByteBuffer` | `readBytes(int length)` Does the same thing as `readFully` do but without copying data (thread safe)
    `void` | `readFully(byte[] bytes)` Reads bytes from this file into `buffer`.
    `void` | `readFully(byte[] bytes, int offset, int count)` Read bytes from this file into `buffer` starting at offset `offset`.
    `void` | `reset(FileMark mark)`
    `void` | `seek(long pos)`
    `java.lang.String` | `toString()`

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

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

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

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

    - ### 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, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes`

    - ### Methods inherited from interface java.io.Closeable

      `close`

- - ### Constructor Detail

    - #### ByteBufferDataInput

          public ByteBufferDataInput(java.nio.ByteBuffer buffer,
                                     java.lang.String filename,
                                     long segmentOffset,
                                     int position)

  - ### Method Detail

    - #### seek

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

      Specified by:
        `seek` in interface `FileDataInput`
      Specified by:
        `seek` in class `AbstractDataInput`
      Throws:
        `java.io.IOException`

    - #### getFilePointer

          public long getFilePointer()

      Specified by:
        `getFilePointer` in interface `FileDataInput`

    - #### getPosition

          public long getPosition()

      Specified by:
        `getPosition` in class `AbstractDataInput`

    - #### getPositionLimit

          public long getPositionLimit()

      Specified by:
        `getPositionLimit` in class `AbstractDataInput`

    - #### markSupported

          public boolean markSupported()

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

    - #### reset

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

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

    - #### mark

          public FileMark mark()

      Specified by:
        `mark` in interface `FileDataInput`

    - #### 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`
      Throws:
        `java.io.IOException`

    - #### bytesRemaining

          public long bytesRemaining()
                              throws java.io.IOException

      Specified by:
        `bytesRemaining` 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`

    - #### readBytes

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

      Does the same thing as `readFully` do but without copying data (thread safe)
      Specified by:
        `readBytes` in interface `FileDataInput`
      Parameters:
        `length` - length of the bytes to read
      Returns:
        buffer with portion of file content
      Throws:
        `java.io.IOException` - on any fail of I/O operation

    - #### readFully

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

      Description copied from class: `AbstractDataInput`
      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`
      Overrides:
        `readFully` in class `AbstractDataInput`
      Parameters:
        `bytes` - 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.

    - #### readFully

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

      Description copied from class: `AbstractDataInput`
      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`
      Overrides:
        `readFully` in class `AbstractDataInput`
      Parameters:
        `bytes` - 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.io.IOException` - if this file is closed or another I/O error occurs.

    - #### toString

          public java.lang.String toString()

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

Copyright © 2018 The Apache Software Foundation