krati.array
Interface DataArray

All Superinterfaces:
Array
All Known Implementing Classes:
AbstractDataArray, DynamicDataArray, SimpleDataArray, StaticDataArray

public interface DataArray
extends Array

Data Array

Author:
jwu

Method Summary
 byte[] get(int index)
          Gets data at a specified index.
 int get(int index, byte[] dst)
          Gets data at a specified index into a byte array.
 int get(int index, byte[] dst, int offset)
          Gets data at a specified index into a byte array.
 int getLength(int index)
           
 boolean hasData(int index)
           
 void set(int index, byte[] data, int offset, int length, long scn)
          Sets data at a specified index.
 void set(int index, byte[] data, long scn)
          Sets data at a specified index.
 int transferTo(int index, WritableByteChannel channel)
          Transfers data at a given index to a writable file channel.
 
Methods inherited from interface krati.array.Array
clear, hasIndex, length
 

Method Detail

hasData

boolean hasData(int index)
Returns:
true if data exists at a given index. Otherwise, false.

getLength

int getLength(int index)
Returns:
the length of data at a specified index

get

byte[] get(int index)
Gets data at a specified index.

Parameters:
index - data index in DataArray
Returns:
data at a specified index

get

int get(int index,
        byte[] dst)
Gets data at a specified index into a byte array.

Parameters:
index - data index in DataArray
dst - the byte array to write to
Returns:
the number of bytes written to the byte array.

get

int get(int index,
        byte[] dst,
        int offset)
Gets data at a specified index into a byte array.

Parameters:
index - data index in DataArray
dst - the byte array to write to
offset - the offset of byte array from where data will be written
Returns:
the number of bytes written to the byte array.

set

void set(int index,
         byte[] data,
         long scn)
         throws Exception
Sets data at a specified index.

Parameters:
index - data index in DataArray
data - data to write to DataArray
scn -
Throws:
Exception

set

void set(int index,
         byte[] data,
         int offset,
         int length,
         long scn)
         throws Exception
Sets data at a specified index.

Parameters:
index - data index in DataArray
data - data to write to DataArray
offset - the offset of the data array to start read
length - the length of data to read from the data array
scn -
Throws:
Exception

transferTo

int transferTo(int index,
               WritableByteChannel channel)
Transfers data at a given index to a writable file channel.

Parameters:
index - data index in DataArray
channel - channel to transfer data to
Returns:
the number of bytes transferred.


Copyright © 2011. All Rights Reserved.