org.eclipse.jetty.io.nio

## Class RandomAccessFileBuffer

- java.lang.Object
- - org.eclipse.jetty.io.AbstractBuffer
  - - org.eclipse.jetty.io.nio.RandomAccessFileBuffer

- All Implemented Interfaces:
    Cloneable, Buffer

      public class RandomAccessFileBuffer
      extends AbstractBuffer
      implements Buffer

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.eclipse.jetty.io.Buffer

      `Buffer.CaseInsensitve`

  - ### Field Summary

    - ### Fields inherited from class org.eclipse.jetty.io.AbstractBuffer

      `__IMMUTABLE, __READONLY, __READWRITE, __VOLATILE, _access, _get, _hash, _hashGet, _hashPut, _mark, _put, _string, _view, _volatile`

    - ### Fields inherited from interface org.eclipse.jetty.io.Buffer

      `IMMUTABLE, NON_VOLATILE, READONLY, READWRITE, VOLATILE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RandomAccessFileBuffer(File file)`
    `RandomAccessFileBuffer(File file, int capacity)`
    `RandomAccessFileBuffer(File file, int capacity, int access)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `array()` Get the underlying array, if one exists.
    `int` | `capacity()` The capacity of the buffer.
    `void` | `clear()` Clear the buffer.
    `byte` | `peek()` Get the byte at the current getIndex without incrementing the getIndex.
    `byte` | `peek(int index)` Get the byte at a specific index in the buffer.
    `int` | `peek(int index, byte[] b, int offset, int length)`
    `void` | `poke(int index, byte b)` Put a specific byte to a specific getIndex.
    `int` | `poke(int index, byte[] b, int offset, int length)` Put a specific byte to a specific getIndex.
    `int` | `writeTo(WritableByteChannel channel, int index, int length)`

    - ### Methods inherited from class org.eclipse.jetty.io.AbstractBuffer

      `asArray, asImmutableBuffer, asMutableBuffer, asNonVolatileBuffer, asReadOnlyBuffer, buffer, compact, duplicate, equals, equalsIgnoreCase, get, get, get, getIndex, hasContent, hashCode, isImmutable, isReadOnly, isVolatile, length, mark, mark, markIndex, peek, poke, put, put, put, put, putIndex, readFrom, reset, rewind, setGetIndex, setMarkIndex, setPutIndex, skip, slice, sliceFromMark, sliceFromMark, space, toDebugString, toDetailString, toString, toString, toString, writeTo`

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

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

    - ### Methods inherited from interface org.eclipse.jetty.io.Buffer

      `asArray, asImmutableBuffer, asMutableBuffer, asNonVolatileBuffer, asReadOnlyBuffer, buffer, compact, equalsIgnoreCase, get, get, get, getIndex, hasContent, isImmutable, isReadOnly, isVolatile, length, mark, mark, markIndex, peek, poke, put, put, put, put, putIndex, readFrom, reset, setGetIndex, setMarkIndex, setPutIndex, skip, slice, sliceFromMark, sliceFromMark, space, toDetailString, toString, toString, writeTo`

- - ### Constructor Detail

    - #### RandomAccessFileBuffer

          public RandomAccessFileBuffer(File file)
                                 throws FileNotFoundException

      Throws:
        `FileNotFoundException`

    - #### RandomAccessFileBuffer

          public RandomAccessFileBuffer(File file,
                                int capacity)
                                 throws FileNotFoundException

      Throws:
        `FileNotFoundException`

    - #### RandomAccessFileBuffer

          public RandomAccessFileBuffer(File file,
                                int capacity,
                                int access)
                                 throws FileNotFoundException

      Throws:
        `FileNotFoundException`

  - ### Method Detail

    - #### array

          public byte[] array()

      Description copied from interface: `Buffer`
      Get the underlying array, if one exists.
      Specified by:
        `array` in interface `Buffer`
      Returns:
        a `byte[]` backing this buffer or null if none exists.

    - #### capacity

          public int capacity()

      Description copied from interface: `Buffer`
      The capacity of the buffer. This is the maximum putIndex that may be set.
      Specified by:
        `capacity` in interface `Buffer`
      Returns:
        an `int` value

    - #### clear

          public void clear()

      Description copied from interface: `Buffer`
      Clear the buffer. getIndex=0, putIndex=0.
      Specified by:
        `clear` in interface `Buffer`
      Overrides:
        `clear` in class `AbstractBuffer`

    - #### peek

          public byte peek()

      Description copied from interface: `Buffer`
      Get the byte at the current getIndex without incrementing the getIndex.
      Specified by:
        `peek` in interface `Buffer`
      Overrides:
        `peek` in class `AbstractBuffer`
      Returns:
        The `byte` value from the current getIndex.

    - #### peek

          public byte peek(int index)

      Description copied from interface: `Buffer`
      Get the byte at a specific index in the buffer.
      Specified by:
        `peek` in interface `Buffer`
      Parameters:
        `index` - an `int` value
      Returns:
        a `byte` value

    - #### peek

          public int peek(int index,
                 byte[] b,
                 int offset,
                 int length)

      Specified by:
        `peek` in interface `Buffer`
      Parameters:
        `index` - an `int` value
        `b` - The byte array to peek into
        `offset` - The offset into the array to start peeking
        `length` - an `int` value
      Returns:
        The number of bytes actually peeked

    - #### poke

          public void poke(int index,
                  byte b)

      Description copied from interface: `Buffer`
      Put a specific byte to a specific getIndex.
      Specified by:
        `poke` in interface `Buffer`
      Parameters:
        `index` - an `int` value
        `b` - a `byte` value

    - #### poke

          public int poke(int index,
                 byte[] b,
                 int offset,
                 int length)

      Description copied from interface: `Buffer`
      Put a specific byte to a specific getIndex.
      Specified by:
        `poke` in interface `Buffer`
      Overrides:
        `poke` in class `AbstractBuffer`
      Parameters:
        `index` - an `int` value
        `b` - a `byte array` value
      Returns:
        The number of bytes actually poked

    - #### writeTo

          public int writeTo(WritableByteChannel channel,
                    int index,
                    int length)
                      throws IOException

      Throws:
        `IOException`

Copyright © 1995-2015 Mort Bay Consulting. All Rights Reserved.