com.thinkaurelius.titan.diskstorage.util

## Class StaticArrayBuffer

- java.lang.Object
- - com.thinkaurelius.titan.diskstorage.util.StaticArrayBuffer

- All Implemented Interfaces:
    StaticBuffer, Comparable<StaticBuffer>
  Direct Known Subclasses:
    ReadArrayBuffer, StaticArrayEntry

      public class StaticArrayBuffer
      extends Object
      implements StaticBuffer

  Implementation of `StaticBuffer` against byte array.

  The byte to primitive conversion code was copied from / is inspired by Kryo's Input class:
  Author:
    Matthias Broecheler (me@matthiasb.com)

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.thinkaurelius.titan.diskstorage.StaticBuffer

      `StaticBuffer.Factory<T>`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `BYTE_LEN`
    `static int` | `CHAR_LEN`
    `static int` | `DOUBLE_LEN`
    `static int` | `FLOAT_LEN`
    `static int` | `INT_LEN`
    `static int` | `LONG_LEN`
    `static int` | `SHORT_LEN`

    - ### Fields inherited from interface com.thinkaurelius.titan.diskstorage.StaticBuffer

      `ARRAY_FACTORY, BB_FACTORY, STATIC_FACTORY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StaticArrayBuffer(byte[] array)`
    `StaticArrayBuffer(byte[] array, int limit)`
    `StaticArrayBuffer(byte[] array, int offset, int limit)`
    `StaticArrayBuffer(StaticArrayBuffer buffer)`
    `StaticArrayBuffer(StaticBuffer buffer)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> T` | `as(StaticBuffer.Factory<T> factory)`
    `protected <T> T` | `as(StaticBuffer.Factory<T> factory, int position, int length)`
    `ByteBuffer` | `asByteBuffer()`
    `ReadBuffer` | `asReadBuffer()`
    `protected int` | `compareTo(int length, StaticArrayBuffer buffer, int bufferLen)`
    `protected int` | `compareTo(int length, StaticBuffer buffer, int bufferLen)`
    `int` | `compareTo(StaticArrayBuffer other)`
    `int` | `compareTo(StaticBuffer other)`
    `boolean` | `equals(Object o)`
    `boolean` | `getBoolean(int position)`
    `byte` | `getByte(int position)`
    `byte[]` | `getBytes(int position, int length)`
    `char` | `getChar(int position)`
    `char[]` | `getChars(int position, int length)`
    `double` | `getDouble(int position)`
    `double[]` | `getDoubles(int position, int length)`
    `float` | `getFloat(int position)`
    `float[]` | `getFloats(int position, int length)`
    `static int` | `getInt(byte[] array, int offset)`
    `int` | `getInt(int position)`
    `int[]` | `getInts(int position, int length)`
    `static long` | `getLong(byte[] array, int offset)`
    `long` | `getLong(int position)`
    `long[]` | `getLongs(int position, int length)`
    `short` | `getShort(int position)`
    `short[]` | `getShorts(int position, int length)`
    `int` | `hashCode()` Thread-safe hashcode method for StaticBuffer written according to Effective Java 2e by Josh Bloch.
    `protected int` | `hashCode(int length)`
    `int` | `length()`
    `static StaticArrayBuffer` | `of(byte[] array)`
    `static StaticArrayBuffer` | `of(ByteBuffer b)`
    `static void` | `putInt(byte[] array, int offset, int value)`
    `static void` | `putLong(byte[] array, int offset, long value)`
    `StaticBuffer` | `subrange(int position, int length)`
    `StaticBuffer` | `subrange(int position, int length, boolean invert)`
    `String` | `toString()`
    `String` | `toString(String separator)`

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

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

- - ### Field Detail

    - #### BYTE_LEN

          public static final int BYTE_LEN

      See Also:
        Constant Field Values

    - #### SHORT_LEN

          public static final int SHORT_LEN

      See Also:
        Constant Field Values

    - #### INT_LEN

          public static final int INT_LEN

      See Also:
        Constant Field Values

    - #### LONG_LEN

          public static final int LONG_LEN

      See Also:
        Constant Field Values

    - #### CHAR_LEN

          public static final int CHAR_LEN

      See Also:
        Constant Field Values

    - #### FLOAT_LEN

          public static final int FLOAT_LEN

      See Also:
        Constant Field Values

    - #### DOUBLE_LEN

          public static final int DOUBLE_LEN

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### StaticArrayBuffer

          public StaticArrayBuffer(byte[] array,
                           int offset,
                           int limit)

    - #### StaticArrayBuffer

          public StaticArrayBuffer(byte[] array)

    - #### StaticArrayBuffer

          public StaticArrayBuffer(byte[] array,
                           int limit)

    - #### StaticArrayBuffer

          public StaticArrayBuffer(StaticBuffer buffer)

    - #### StaticArrayBuffer

          public StaticArrayBuffer(StaticArrayBuffer buffer)

  - ### Method Detail

    - #### of

          public static StaticArrayBuffer of(byte[] array)

    - #### of

          public static StaticArrayBuffer of(ByteBuffer b)

    - #### length

          public int length()

      Specified by:
        `length` in interface `StaticBuffer`

    - #### subrange

          public StaticBuffer subrange(int position,
                              int length)

      Specified by:
        `subrange` in interface `StaticBuffer`

    - #### subrange

          public StaticBuffer subrange(int position,
                              int length,
                              boolean invert)

      Specified by:
        `subrange` in interface `StaticBuffer`

    - #### asReadBuffer

          public ReadBuffer asReadBuffer()

      Specified by:
        `asReadBuffer` in interface `StaticBuffer`

    - #### asByteBuffer

          public ByteBuffer asByteBuffer()

      Specified by:
        `asByteBuffer` in interface `StaticBuffer`

    - #### as

          public <T> T as(StaticBuffer.Factory<T> factory)

      Specified by:
        `as` in interface `StaticBuffer`

    - #### as

          protected <T> T as(StaticBuffer.Factory<T> factory,
                 int position,
                 int length)

    - #### getByte

          public byte getByte(int position)

      Specified by:
        `getByte` in interface `StaticBuffer`

    - #### getBoolean

          public boolean getBoolean(int position)

      Specified by:
        `getBoolean` in interface `StaticBuffer`

    - #### getShort

          public short getShort(int position)

      Specified by:
        `getShort` in interface `StaticBuffer`

    - #### getInt

          public int getInt(int position)

      Specified by:
        `getInt` in interface `StaticBuffer`

    - #### getInt

          public static int getInt(byte[] array,
                   int offset)

    - #### putInt

          public static void putInt(byte[] array,
                    int offset,
                    int value)

    - #### getLong

          public long getLong(int position)

      Specified by:
        `getLong` in interface `StaticBuffer`

    - #### getLong

          public static long getLong(byte[] array,
                     int offset)

    - #### putLong

          public static void putLong(byte[] array,
                     int offset,
                     long value)

    - #### getChar

          public char getChar(int position)

      Specified by:
        `getChar` in interface `StaticBuffer`

    - #### getFloat

          public float getFloat(int position)

      Specified by:
        `getFloat` in interface `StaticBuffer`

    - #### getDouble

          public double getDouble(int position)

      Specified by:
        `getDouble` in interface `StaticBuffer`

    - #### getBytes

          public byte[] getBytes(int position,
                        int length)

      Specified by:
        `getBytes` in interface `StaticBuffer`

    - #### getShorts

          public short[] getShorts(int position,
                          int length)

      Specified by:
        `getShorts` in interface `StaticBuffer`

    - #### getInts

          public int[] getInts(int position,
                      int length)

      Specified by:
        `getInts` in interface `StaticBuffer`

    - #### getLongs

          public long[] getLongs(int position,
                        int length)

      Specified by:
        `getLongs` in interface `StaticBuffer`

    - #### getChars

          public char[] getChars(int position,
                        int length)

      Specified by:
        `getChars` in interface `StaticBuffer`

    - #### getFloats

          public float[] getFloats(int position,
                          int length)

      Specified by:
        `getFloats` in interface `StaticBuffer`

    - #### getDoubles

          public double[] getDoubles(int position,
                            int length)

      Specified by:
        `getDoubles` in interface `StaticBuffer`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Thread-safe hashcode method for StaticBuffer written according to Effective Java 2e by Josh Bloch.
      Overrides:
        `hashCode` in class `Object`
      Returns:
        hashcode for given StaticBuffer

    - #### hashCode

          protected int hashCode(int length)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### toString

          public final String toString(String separator)

    - #### compareTo

          public int compareTo(StaticBuffer other)

      Specified by:
        `compareTo` in interface `Comparable<StaticBuffer>`

    - #### compareTo

          public int compareTo(StaticArrayBuffer other)

    - #### compareTo

          protected int compareTo(int length,
                      StaticBuffer buffer,
                      int bufferLen)

    - #### compareTo

          protected int compareTo(int length,
                      StaticArrayBuffer buffer,
                      int bufferLen)

Copyright © 2012–2014. All rights reserved.