com.bigdata.io
Class FixedByteArrayBuffer

java.lang.Object
  extended by com.bigdata.io.AbstractFixedByteArrayBuffer
      extended by com.bigdata.io.FixedByteArrayBuffer
All Implemented Interfaces:
IByteArraySlice, IDataRecord, IFixedDataRecord

public class FixedByteArrayBuffer
extends AbstractFixedByteArrayBuffer

Efficient absolute get/put operations on a slice of a byte[]. This class is not thread-safe under mutation because the operations are not atomic. Concurrent operations on the same region of the slice can reveal partial updates.

Version:
$Id: FixedByteArrayBuffer.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Field Summary
static FixedByteArrayBuffer EMPTY
          An empty slice.
 
Constructor Summary
FixedByteArrayBuffer(byte[] buf, int off, int len)
          Create a slice of a byte[].
FixedByteArrayBuffer(int capacity)
          Create an instance backed by a fixed capacity byte[].
 
Method Summary
 byte[] array()
          The backing byte[].
 
Methods inherited from class com.bigdata.io.AbstractFixedByteArrayBuffer
asByteBuffer, get, get, getBit, getByte, getDataInput, getDouble, getFloat, getInputBitStream, getInt, getLong, getShort, len, off, put, put, putByte, putDouble, putFloat, putInt, putLong, putShort, rangeCheck, setBit, slice, toByteArray, wrap, writeOn, writeOn, writeOn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

public static final transient FixedByteArrayBuffer EMPTY
An empty slice.

Constructor Detail

FixedByteArrayBuffer

public FixedByteArrayBuffer(int capacity)
Create an instance backed by a fixed capacity byte[].

Parameters:
capacity - The capacity of the backing byte[].

FixedByteArrayBuffer

public FixedByteArrayBuffer(byte[] buf,
                            int off,
                            int len)
Create a slice of a byte[].

Parameters:
buf - The byte[].
off - The starting offset of the slice.
len - The length of the slice.
Method Detail

array

public final byte[] array()
Description copied from interface: IByteArraySlice
The backing byte[]. This method DOES NOT guarantee that the backing array reference will remain constant. Some implementations use an extensible backing byte[] and will replace the reference when the backing buffer is extended.



Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.