com.thinkaurelius.titan.diskstorage.util

## Class ByteBufferUtil

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

-     public class ByteBufferUtil
      extends Object

  Utility methods for dealing with ByteBuffers in concurrent access environments, i.e. these methods only use static access to the buffer.
  Author:
    Matthias Broecheler (me@matthiasb.com)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ByteBufferUtil()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `bytesToHex(ByteBuffer bytes)`
    `static int` | `compare(ByteBuffer b1, ByteBuffer b2)` Compares two `ByteBuffer`s according to their byte order (and not the byte value).
    `static boolean` | `isSmallerOrEqualThan(ByteBuffer a, ByteBuffer b)` Compares two `ByteBuffer`s and checks whether the first ByteBuffer is smaller than or equal to the second.
    `static boolean` | `isSmallerThan(ByteBuffer a, ByteBuffer b)` Compares two `ByteBuffer`s and checks whether the first ByteBuffer is smaller than the second.
    `static ByteBuffer` | `oneByteBuffer(int len)`
    `static String` | `toString(ByteBuffer b, String separator)`
    `static ByteBuffer` | `zeroByteBuffer(int len)`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ByteBufferUtil

          public ByteBufferUtil()

  - ### Method Detail

    - #### zeroByteBuffer

          public static final ByteBuffer zeroByteBuffer(int len)

    - #### oneByteBuffer

          public static final ByteBuffer oneByteBuffer(int len)

    - #### isSmallerThan

          public static final boolean isSmallerThan(ByteBuffer a,
                              ByteBuffer b)

      Compares two `ByteBuffer`s and checks whether the first ByteBuffer is smaller than the second.
      Parameters:
        `a` - First ByteBuffer
        `b` - Second ByteBuffer
      Returns:
        true if the first ByteBuffer is smaller than the second

    - #### isSmallerOrEqualThan

          public static boolean isSmallerOrEqualThan(ByteBuffer a,
                                     ByteBuffer b)

      Compares two `ByteBuffer`s and checks whether the first ByteBuffer is smaller than or equal to the second.
      Parameters:
        `a` - First ByteBuffer
        `b` - Second ByteBuffer
      Returns:
        true if the first ByteBuffer is smaller than or equal to the second

    - #### compare

          public static final int compare(ByteBuffer b1,
                    ByteBuffer b2)

      Compares two `ByteBuffer`s according to their byte order (and not the byte value).

      Parameters:
        `b1` - First ByteBuffer
        `b2` - Second ByteBuffer
      Returns:
        a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

    - #### bytesToHex

          public static String bytesToHex(ByteBuffer bytes)

    - #### toString

          public static final String toString(ByteBuffer b,
                        String separator)

Copyright © 2012–2014. All rights reserved.