com.bigdata.io
Interface IDataRecord

All Superinterfaces:
IByteArraySlice
All Known Subinterfaces:
IByteArrayBuffer, IFixedDataRecord
All Known Implementing Classes:
AbstractFixedByteArrayBuffer, ByteArrayBuffer, DataOutputBuffer, FixedByteArrayBuffer

public interface IDataRecord
extends IByteArraySlice

An interface for absolute get/put operations on a slice of a byte[].

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

Method Summary
 ByteBuffer asByteBuffer()
          Wraps the data in the slice within a ByteBuffer (does NOT copy the data).
 void get(int srcoff, byte[] dst)
          Absolute bulk get copies dst.length bytes from the specified offset into the slice defined by this buffer into the caller's array.
 void get(int srcoff, byte[] dst, int dstoff, int dstlen)
          Absolute bulk get copies the specified slice of bytes from this buffer into the specified slice of the caller's array.
 boolean getBit(long bitIndex)
          Get the value of a bit.
 byte getByte(int pos)
          Absolute get for reading a byte value.
 double getDouble(int pos)
           
 float getFloat(int pos)
           
 int getInt(int pos)
           
 long getLong(int pos)
           
 short getShort(int pos)
           
 void put(int pos, byte[] src)
          Absolute bulk put copies all bytes in the caller's array into this buffer starting at the specified position within the slice defined by this buffer.
 void put(int dstoff, byte[] src, int srcoff, int srclen)
          Absolute bulk put copies the specified slice of bytes from the caller's array into this buffer starting at the specified position within the slice defined by this buffer.
 void putByte(int pos, byte v)
          Absolute put method for writing a byte value.
 void putDouble(int pos, double d)
           
 void putFloat(int pos, float f)
           
 void putInt(int pos, int v)
           
 void putLong(int pos, long v)
           
 void putShort(int pos, short v)
           
 boolean setBit(long bitIndex, boolean value)
          Set the value of a bit.
 IDataRecord slice(int aoff, int alen)
          Return a slice of the backing buffer.
 byte[] toByteArray()
          Return a copy of the data in the slice.
 
Methods inherited from interface com.bigdata.io.IByteArraySlice
array, len, off
 

Method Detail

slice

IDataRecord slice(int aoff,
                  int alen)
Return a slice of the backing buffer.

Parameters:
aoff - The starting offset of the slice into this slice.
alen - The #of bytes in the slice.
Returns:
The slice.

toByteArray

byte[] toByteArray()
Return a copy of the data in the slice.

Returns:
A new array containing data in the slice.
See Also:
asByteBuffer()

asByteBuffer

ByteBuffer asByteBuffer()
Wraps the data in the slice within a ByteBuffer (does NOT copy the data).

Returns:
A ByteBuffer encapsulating a reference to the data in the slice.

put

void put(int pos,
         byte[] src)
Absolute bulk put copies all bytes in the caller's array into this buffer starting at the specified position within the slice defined by this buffer.

Parameters:
pos - The starting position within the slice defined by this buffer.
src - The source data.

put

void put(int dstoff,
         byte[] src,
         int srcoff,
         int srclen)
Absolute bulk put copies the specified slice of bytes from the caller's array into this buffer starting at the specified position within the slice defined by this buffer.

Parameters:
dstoff - The offset into the slice to which the data will be copied.
src - The source data.
srcoff - The offset of the 1st byte in the source data to be copied.
srclen - The #of bytes to be copied.

get

void get(int srcoff,
         byte[] dst)
Absolute bulk get copies dst.length bytes from the specified offset into the slice defined by this buffer into the caller's array.

Parameters:
srcoff - The offset into the slice of the first byte to be copied.
dst - The array into which the data will be copied.

get

void get(int srcoff,
         byte[] dst,
         int dstoff,
         int dstlen)
Absolute bulk get copies the specified slice of bytes from this buffer into the specified slice of the caller's array.

Parameters:
srcoff - The offset into the slice defined by this buffer of the first byte to be copied.
dst - The array into which the data will be copied.
dstoff - The offset of the first byte in that array onto which the data will be copied.
dstlen - The #of bytes to be copied.

putByte

void putByte(int pos,
             byte v)
Absolute put method for writing a byte value.

Parameters:
pos - The offset into the slice.
v - The value.
TODO:
rename as get(int,byte) to conform with ByteBuffer?

getByte

byte getByte(int pos)
Absolute get for reading a byte value.

Parameters:
pos - The offset into the slice.
Returns:
The byte value at that offset.
TODO:
rename as get(int,byte) to conform with ByteBuffer?

putShort

void putShort(int pos,
              short v)

getShort

short getShort(int pos)

putInt

void putInt(int pos,
            int v)

getInt

int getInt(int pos)

putFloat

void putFloat(int pos,
              float f)

getFloat

float getFloat(int pos)

putLong

void putLong(int pos,
             long v)

putDouble

void putDouble(int pos,
               double d)

getLong

long getLong(int pos)

getDouble

double getDouble(int pos)

getBit

boolean getBit(long bitIndex)
Get the value of a bit.

Parameters:
bitIndex - The index of the bit, counting from the first bit position in the slice.
Returns:
The value of the bit.

setBit

boolean setBit(long bitIndex,
               boolean value)
Set the value of a bit.

Parameters:
bitIndex - The index of the bit, counting from the first bit position in the slice.
Returns:
The old value of the bit.


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