com.kenai.jaffl.provider
Class AbstractArrayMemoryIO

java.lang.Object
  extended by com.kenai.jaffl.MemoryIO
      extended by com.kenai.jaffl.provider.AbstractMemoryIO
          extended by com.kenai.jaffl.provider.AbstractArrayMemoryIO
All Implemented Interfaces:
Pointer
Direct Known Subclasses:
ArrayMemoryIO

public abstract class AbstractArrayMemoryIO
extends AbstractMemoryIO


Nested Class Summary
protected static class AbstractArrayMemoryIO.ArrayIO
           
 
Field Summary
protected  byte[] buffer
           
protected static AbstractArrayMemoryIO.ArrayIO IO
           
protected  int length
           
protected static int LONG_SIZE
           
protected  int offset
           
 
Fields inherited from interface com.kenai.jaffl.Pointer
SIZE
 
Constructor Summary
AbstractArrayMemoryIO(byte[] buffer)
           
AbstractArrayMemoryIO(byte[] buffer, int offset, int length)
           
AbstractArrayMemoryIO(int size)
           
 
Method Summary
 long address()
          Gets the native address of this memory object (optional operation).
 byte[] array()
           
 void clear()
           
 void get(long offset, byte[] dst, int off, int len)
          Bulk byte get method.
 void get(long offset, double[] dst, int off, int len)
          Bulk double get method.
 void get(long offset, float[] dst, int off, int len)
          Bulk float get method.
 void get(long offset, int[] dst, int off, int len)
          Bulk int get method.
 void get(long offset, long[] dst, int off, int len)
          Bulk long get method.
 void get(long offset, short[] dst, int off, int len)
          Bulk short get method.
 long getAddress(long offset)
           
 byte getByte(long offset)
          Reads a 8 bit integer at the given offset.
 double getDouble(long offset)
          Reads a 64 bit floating point value at the given offset.
 float getFloat(long offset)
          Reads a 32 bit floating point value at the given offset.
 int getInt(long offset)
          Reads a 32 bit integer at the given offset.
 long getLong(long offset)
          Reads a 64 bit integer at the given offset.
 short getShort(long offset)
          Reads a 16 bit integer at the given offset.
 String getString(long offset)
           
 String getString(long offset, int maxLength, Charset cs)
           
protected  int index(long off)
           
 int indexOf(long offset, byte value)
           
 int indexOf(long offset, byte value, int maxlen)
           
 boolean isDirect()
          Tells whether or not this memory object is direct.
 boolean isNull()
           
 int length()
           
 int offset()
           
 void put(long offset, byte[] src, int off, int len)
          Bulk byte put method.
 void put(long offset, double[] src, int off, int len)
          Bulk double put method.
 void put(long offset, float[] src, int off, int len)
          Bulk float put method.
 void put(long offset, int[] src, int off, int len)
          Bulk int put method.
 void put(long offset, long[] src, int off, int len)
          Bulk long put method.
 void put(long offset, short[] src, int off, int len)
          Bulk short put method.
 void putAddress(long offset, long value)
           
 void putByte(long offset, byte value)
          Writes an 8 bit integer value at the given offset.
 void putDouble(long offset, double value)
          Writes a 64 bit floating point value at the given offset.
 void putFloat(long offset, float value)
          Writes a 32 bit floating point value at the given offset.
 void putInt(long offset, int value)
          Writes a 32 bit integer value at the given offset.
 void putLong(long offset, long value)
          Writes a 64 bit integer value at the given offset.
 void putShort(long offset, short value)
          Writes a 16 bit integer value at the given offset.
 void putString(long offset, String string, int maxLength, Charset cs)
           
 void setMemory(long offset, long size, byte value)
           
 
Methods inherited from class com.kenai.jaffl.provider.AbstractMemoryIO
checkBounds, getNativeLong, putAddress, putNativeLong, slice, slice, transferFrom, transferTo
 
Methods inherited from class com.kenai.jaffl.MemoryIO
allocate, allocateDirect, allocateDirect, getMemoryIO, getMemoryIO, getPointer, putPointer, wrap, wrap, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IO

protected static final AbstractArrayMemoryIO.ArrayIO IO

LONG_SIZE

protected static final int LONG_SIZE

buffer

protected final byte[] buffer

offset

protected final int offset

length

protected final int length
Constructor Detail

AbstractArrayMemoryIO

public AbstractArrayMemoryIO(byte[] buffer,
                             int offset,
                             int length)

AbstractArrayMemoryIO

public AbstractArrayMemoryIO(byte[] buffer)

AbstractArrayMemoryIO

public AbstractArrayMemoryIO(int size)
Method Detail

array

public final byte[] array()

offset

public final int offset()

length

public final int length()

isDirect

public final boolean isDirect()
Description copied from class: MemoryIO
Tells whether or not this memory object is direct. Memory objects can be either direct (representing native memory), or non-direct (representing java heap memory).

Specified by:
isDirect in interface Pointer
Specified by:
isDirect in class MemoryIO
Returns:
true if, and only if, this memory object is direct

address

public long address()
Description copied from class: MemoryIO
Gets the native address of this memory object (optional operation).

Specified by:
address in interface Pointer
Specified by:
address in class MemoryIO
Returns:
The native address of this memory object.

index

protected final int index(long off)

isNull

public final boolean isNull()

getString

public String getString(long offset)
Specified by:
getString in interface Pointer
Specified by:
getString in class MemoryIO

getString

public String getString(long offset,
                        int maxLength,
                        Charset cs)
Specified by:
getString in class MemoryIO

putString

public void putString(long offset,
                      String string,
                      int maxLength,
                      Charset cs)
Specified by:
putString in class MemoryIO

getByte

public final byte getByte(long offset)
Description copied from class: MemoryIO
Reads a 8 bit integer at the given offset.

Specified by:
getByte in interface Pointer
Specified by:
getByte in class MemoryIO
Parameters:
offset - The offset from which the integer will be read.
Returns:
The byte value at the offset.

getShort

public final short getShort(long offset)
Description copied from class: MemoryIO
Reads a 16 bit integer at the given offset.

Specified by:
getShort in interface Pointer
Specified by:
getShort in class MemoryIO
Parameters:
offset - The offset from which the integer will be read.
Returns:
The short value at the offset.

getInt

public final int getInt(long offset)
Description copied from class: MemoryIO
Reads a 32 bit integer at the given offset.

Specified by:
getInt in interface Pointer
Specified by:
getInt in class MemoryIO
Parameters:
offset - The offset from which the integer will be read.
Returns:
The int value at the offset.

getLong

public final long getLong(long offset)
Description copied from class: MemoryIO
Reads a 64 bit integer at the given offset.

Specified by:
getLong in interface Pointer
Specified by:
getLong in class MemoryIO
Parameters:
offset - The offset from which the integer will be read.
Returns:
The long value at the offset.

getAddress

public final long getAddress(long offset)
Overrides:
getAddress in class AbstractMemoryIO

getFloat

public final float getFloat(long offset)
Description copied from class: MemoryIO
Reads a 32 bit floating point value at the given offset.

Specified by:
getFloat in interface Pointer
Specified by:
getFloat in class MemoryIO
Parameters:
offset - The offset from which the integer will be read.
Returns:
The float value at the offset.

getDouble

public final double getDouble(long offset)
Description copied from class: MemoryIO
Reads a 64 bit floating point value at the given offset.

Specified by:
getDouble in interface Pointer
Specified by:
getDouble in class MemoryIO
Parameters:
offset - The offset from which the integer will be read.
Returns:
The double value at the offset.

putByte

public final void putByte(long offset,
                          byte value)
Description copied from class: MemoryIO
Writes an 8 bit integer value at the given offset.

Specified by:
putByte in interface Pointer
Specified by:
putByte in class MemoryIO
Parameters:
offset - The offset at which the value will be written.
value - The value to be written.

putShort

public final void putShort(long offset,
                           short value)
Description copied from class: MemoryIO
Writes a 16 bit integer value at the given offset.

Specified by:
putShort in interface Pointer
Specified by:
putShort in class MemoryIO
Parameters:
offset - The offset at which the value will be written.
value - The value to be written.

putInt

public final void putInt(long offset,
                         int value)
Description copied from class: MemoryIO
Writes a 32 bit integer value at the given offset.

Specified by:
putInt in interface Pointer
Specified by:
putInt in class MemoryIO
Parameters:
offset - The offset at which the value will be written.
value - The value to be written.

putLong

public final void putLong(long offset,
                          long value)
Description copied from class: MemoryIO
Writes a 64 bit integer value at the given offset.

Specified by:
putLong in interface Pointer
Specified by:
putLong in class MemoryIO
Parameters:
offset - The offset at which the value will be written.
value - The value to be written.

putAddress

public final void putAddress(long offset,
                             long value)
Overrides:
putAddress in class AbstractMemoryIO

putFloat

public final void putFloat(long offset,
                           float value)
Description copied from class: MemoryIO
Writes a 32 bit floating point value at the given offset.

Specified by:
putFloat in interface Pointer
Specified by:
putFloat in class MemoryIO
Parameters:
offset - The offset at which the value will be written.
value - The value to be written.

putDouble

public final void putDouble(long offset,
                            double value)
Description copied from class: MemoryIO
Writes a 64 bit floating point value at the given offset.

Specified by:
putDouble in interface Pointer
Specified by:
putDouble in class MemoryIO
Parameters:
offset - The offset at which the value will be written.
value - The value to be written.

get

public final void get(long offset,
                      byte[] dst,
                      int off,
                      int len)
Description copied from class: MemoryIO
Bulk byte get method. This method reads an array of bytes at the given offset into the given destination array.

Specified by:
get in interface Pointer
Specified by:
get in class MemoryIO
Parameters:
offset - The offset at which the values will be read.
dst - The array into which values are to be written.
off - The index within the destination array of the first value to be written.
len - The number of values to be written to the destination array.

put

public final void put(long offset,
                      byte[] src,
                      int off,
                      int len)
Description copied from class: MemoryIO
Bulk byte put method. This method writes an array of bytes at the given offset from the given source array.

Specified by:
put in interface Pointer
Specified by:
put in class MemoryIO
Parameters:
offset - The offset at which the values will be written.
src - The source array from which values are to be read.
off - The index within the destination array of the first value to be read.
len - The number of values to be read from the source array.

get

public final void get(long offset,
                      short[] dst,
                      int off,
                      int len)
Description copied from class: MemoryIO
Bulk short get method. This method reads an array of 16 bit integers at the given offset into the given destination array.

Specified by:
get in interface Pointer
Specified by:
get in class MemoryIO
Parameters:
offset - The offset at which the values will be read.
dst - The array into which values are to be written.
off - The index within the destination array of the first value to be written.
len - The number of values to be written to the destination array.

put

public final void put(long offset,
                      short[] src,
                      int off,
                      int len)
Description copied from class: MemoryIO
Bulk short put method. This method writes an array of 16 bit integers at the given offset from the given array.

Specified by:
put in interface Pointer
Specified by:
put in class MemoryIO
Parameters:
offset - The offset at which the values will be written.
src - The source array from which values are to be read.
off - The index within the destination array of the first value to be read.
len - The number of values to be read from the source array.

get

public final void get(long offset,
                      int[] dst,
                      int off,
                      int len)
Description copied from class: MemoryIO
Bulk int get method. This method reads an array of 32 bit integers at the given offset into the given destination array.

Specified by:
get in interface Pointer
Specified by:
get in class MemoryIO
Parameters:
offset - The offset at which the values will be read.
dst - The array into which values are to be written.
off - The index within the destination array of the first value to be written.
len - The number of values to be written to the destination array.

put

public final void put(long offset,
                      int[] src,
                      int off,
                      int len)
Description copied from class: MemoryIO
Bulk int put method. This method writes an array of 32 bit integers at the given offset from the given array.

Specified by:
put in interface Pointer
Specified by:
put in class MemoryIO
Parameters:
offset - The offset at which the values will be written.
src - The source array from which values are to be read.
off - The index within the destination array of the first value to be read.
len - The number of values to be read from the source array.

get

public final void get(long offset,
                      long[] dst,
                      int off,
                      int len)
Description copied from class: MemoryIO
Bulk long get method. This method reads an array of 64 bit integers at the given offset into the given destination array.

Specified by:
get in interface Pointer
Specified by:
get in class MemoryIO
Parameters:
offset - The offset at which the values will be read.
dst - The array into which values are to be written.
off - The index within the destination array of the first value to be written.
len - The number of values to be written to the destination array.

put

public final void put(long offset,
                      long[] src,
                      int off,
                      int len)
Description copied from class: MemoryIO
Bulk long put method. This method writes an array of 64 bit integers at the given offset from the given array.

Specified by:
put in interface Pointer
Specified by:
put in class MemoryIO
Parameters:
offset - The offset at which the values will be written.
src - The source array from which values are to be read.
off - The index within the destination array of the first value to be read.
len - The number of values to be read from the source array.

get

public final void get(long offset,
                      float[] dst,
                      int off,
                      int len)
Description copied from class: MemoryIO
Bulk float get method. This method reads an array of 32 bit floats at the given offset into the given destination array.

Specified by:
get in interface Pointer
Specified by:
get in class MemoryIO
Parameters:
offset - The offset at which the values will be read.
dst - The array into which values are to be written.
off - The index within the destination array of the first value to be written.
len - The number of values to be written to the destination array.

put

public final void put(long offset,
                      float[] src,
                      int off,
                      int len)
Description copied from class: MemoryIO
Bulk float put method. This method writes an array of 32 bit floats at the given offset from the given array.

Specified by:
put in interface Pointer
Specified by:
put in class MemoryIO
Parameters:
offset - The offset at which the values will be written.
src - The source array from which values are to be read.
off - The index within the destination array of the first value to be read.
len - The number of values to be read from the source array.

get

public final void get(long offset,
                      double[] dst,
                      int off,
                      int len)
Description copied from class: MemoryIO
Bulk double get method. This method reads an array of 64 bit floats at the given offset into the given destination array.

Specified by:
get in interface Pointer
Specified by:
get in class MemoryIO
Parameters:
offset - The offset at which the values will be read.
dst - The array into which values are to be written.
off - The index within the destination array of the first value to be written.
len - The number of values to be written to the destination array.

put

public final void put(long offset,
                      double[] src,
                      int off,
                      int len)
Description copied from class: MemoryIO
Bulk double put method. This method writes an array of 64 bit floats at the given offset from the given array.

Specified by:
put in interface Pointer
Specified by:
put in class MemoryIO
Parameters:
offset - The offset at which the values will be written.
src - The source array from which values are to be read.
off - The index within the destination array of the first value to be read.
len - The number of values to be read from the source array.

indexOf

public final int indexOf(long offset,
                         byte value)
Overrides:
indexOf in class AbstractMemoryIO

indexOf

public final int indexOf(long offset,
                         byte value,
                         int maxlen)
Specified by:
indexOf in class MemoryIO

setMemory

public final void setMemory(long offset,
                            long size,
                            byte value)
Specified by:
setMemory in class MemoryIO

clear

public final void clear()


Copyright © 2011. All Rights Reserved.