org.apache.mina.util.byteaccess

## Interface ByteArray

- All Superinterfaces:
    IoAbsoluteReader, IoAbsoluteWriter
  All Known Implementing Classes:
    BufferByteArray, CompositeByteArray

      public interface ByteArray
      extends IoAbsoluteReader, IoAbsoluteWriter

  Represents a sequence of bytes that can be read or written directly or through a cursor.
  Author:
    Apache MINA Project

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `ByteArray.Cursor` Provides relocatable, relative access to the underlying array.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ByteArray.Cursor` | `cursor()` Get a cursor starting at index 0 (which may not be the start of the array).
    `ByteArray.Cursor` | `cursor(int index)` Get a cursor starting at the given index.
    `boolean` | `equals(Object other)` A ByteArray is equal to another ByteArray if they start and end at the same index, have the same byte order, and contain the same bytes at each index.
    `int` | `first()` Get the index of the first byte that can be accessed.
    `void` | `free()` Remove any resources associated with this object.
    `byte` | `get(int index)` Gets a `byte` from the given index.
    `void` | `get(int index, IoBuffer bb)` Gets enough bytes to fill the `IoBuffer` from the given index.
    `int` | `getInt(int index)` Gets an `int` from the given index.
    `Iterable<IoBuffer>` | `getIoBuffers()` Get the sequence of `IoBuffer`s that back this array.
    `IoBuffer` | `getSingleIoBuffer()` Gets a single `IoBuffer` that backs this array.
    `int` | `last()` Gets the index after the last byte that can be accessed.
    `ByteOrder` | `order()` Gets the order of the bytes.
    `void` | `order(ByteOrder order)` Set the byte order of the array.

    - ### Methods inherited from interface org.apache.mina.util.byteaccess.IoAbsoluteReader

      `getChar, getDouble, getFloat, getLong, getShort, length, slice`

    - ### Methods inherited from interface org.apache.mina.util.byteaccess.IoAbsoluteWriter

      `put, put, putChar, putDouble, putFloat, putInt, putLong, putShort`

- - ### Method Detail

    - #### first

          int first()

      Description copied from interface: `IoAbsoluteReader`
      Get the index of the first byte that can be accessed.
      Specified by:
        `first` in interface `IoAbsoluteReader`
      Specified by:
        `first` in interface `IoAbsoluteWriter`

    - #### last

          int last()

      Description copied from interface: `IoAbsoluteReader`
      Gets the index after the last byte that can be accessed.
      Specified by:
        `last` in interface `IoAbsoluteReader`
      Specified by:
        `last` in interface `IoAbsoluteWriter`

    - #### order

          ByteOrder order()

      Description copied from interface: `IoAbsoluteReader`
      Gets the order of the bytes.
      Specified by:
        `order` in interface `IoAbsoluteReader`
      Specified by:
        `order` in interface `IoAbsoluteWriter`

    - #### order

          void order(ByteOrder order)

      Set the byte order of the array.

    - #### free

          void free()

      Remove any resources associated with this object. Using the object after this method is called may result in undefined behaviour.

    - #### getIoBuffers

          Iterable<IoBuffer> getIoBuffers()

      Get the sequence of `IoBuffer`s that back this array. Compared to `getSingleIoBuffer()`, this method should be relatively efficient for all implementations.

    - #### getSingleIoBuffer

          IoBuffer getSingleIoBuffer()

      Gets a single `IoBuffer` that backs this array. Some implementations may initially have data split across multiple buffers, so calling this method may require a new buffer to be allocated and populated.

    - #### equals

          boolean equals(Object other)

      A ByteArray is equal to another ByteArray if they start and end at the same index, have the same byte order, and contain the same bytes at each index.
      Overrides:
        `equals` in class `Object`

    - #### get

          byte get(int index)

      Description copied from interface: `IoAbsoluteReader`
      Gets a `byte` from the given index.
      Specified by:
        `get` in interface `IoAbsoluteReader`

    - #### get

          void get(int index,
                 IoBuffer bb)

      Description copied from interface: `IoAbsoluteReader`
      Gets enough bytes to fill the `IoBuffer` from the given index.
      Specified by:
        `get` in interface `IoAbsoluteReader`

    - #### getInt

          int getInt(int index)

      Description copied from interface: `IoAbsoluteReader`
      Gets an `int` from the given index.
      Specified by:
        `getInt` in interface `IoAbsoluteReader`

    - #### cursor

          ByteArray.Cursor cursor()

      Get a cursor starting at index 0 (which may not be the start of the array).

    - #### cursor

          ByteArray.Cursor cursor(int index)

      Get a cursor starting at the given index.

Copyright © 2004-2012 Apache MINA Project. All Rights Reserved.