ByteArray (Hadoop 0.20.2-CDH3B4 API)
Date: 2011-02-21

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.io.file.tfile
Class ByteArray

    java.lang.Object
      org.apache.hadoop.io.file.tfile.ByteArray

All Implemented Interfaces:
  RawComparable

    public final class ByteArray

extends Object
implements RawComparable

Adaptor class to wrap byte-array backed objects (including java byte array) as RawComparable objects.

Constructor Summary
`ByteArray(byte[] buffer)` Wrap a whole byte array as a RawComparable.
`ByteArray(byte[] buffer, int offset, int len)` Wrap a partial byte array as a RawComparable.
`ByteArray(BytesWritable other)` Constructing a ByteArray from a `BytesWritable`.

Method Summary
`byte[]` | `buffer()` Get the underlying byte array.
`int` | `offset()` Get the offset of the first byte in the byte array.
`int` | `size()` Get the size of the byte range in the byte array.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ByteArray

    public ByteArray(BytesWritable other)

  Constructing a ByteArray from a `BytesWritable`.

  Parameters:
    `other` -

### ByteArray

    public ByteArray(byte[] buffer)

  Wrap a whole byte array as a RawComparable.

  Parameters:
    `buffer` - the byte array buffer.

### ByteArray

    public ByteArray(byte[] buffer,
                     int offset,
                     int len)

  Wrap a partial byte array as a RawComparable.

  Parameters:
    `buffer` - the byte array buffer.
    `offset` - the starting offset
    `len` - the length of the consecutive bytes to be wrapped.

Method Detail

### buffer

    public byte[] buffer()

  Description copied from interface: `RawComparable`
  Get the underlying byte array.

  Specified by:
    `buffer` in interface `RawComparable`
  Returns:
    the underlying buffer.

### offset

    public int offset()

  Description copied from interface: `RawComparable`
  Get the offset of the first byte in the byte array.

  Specified by:
    `offset` in interface `RawComparable`
  Returns:
    the offset in the buffer.

### size

    public int size()

  Description copied from interface: `RawComparable`
  Get the size of the byte range in the byte array.

  Specified by:
    `size` in interface `RawComparable`
  Returns:
    the size of the byte array.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation