jodd.util.buffer
Class FastFloatBuffer

java.lang.Object
  extended by jodd.util.buffer.FastFloatBuffer

public class FastFloatBuffer
extends java.lang.Object

Fast, fast float buffer.


Constructor Summary
FastFloatBuffer()
          Creates a new float buffer.
FastFloatBuffer(int size)
          Creates a new float buffer, with a buffer capacity of the specified size, in bytes.
 
Method Summary
 FastFloatBuffer append(FastFloatBuffer buff)
          Appends another fast buffer to this one.
 FastFloatBuffer append(float element)
          Appends single float to buffer.
 FastFloatBuffer append(float[] array)
          Appends float array to buffer.
 FastFloatBuffer append(float[] array, int off, int len)
          Appends float array to buffer.
 float[] array(int index)
          Returns float inner array chunk at given index.
 void clear()
          Resets the buffer content.
 float get(int index)
          Returns float element at given index.
 int index()
          Returns current index of inner float array chunk.
 boolean isEmpty()
          Tests if this buffer has no elements.
 int offset()
          Returns the offset of last used element in current inner array chunk.
 int size()
          Returns buffer size.
 float[] toArray()
          Creates float array from buffered content.
 float[] toArray(int start, int len)
          Creates float subarray from buffered content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FastFloatBuffer

public FastFloatBuffer()
Creates a new float buffer. The buffer capacity is initially 1024 bytes, though its size increases if necessary.


FastFloatBuffer

public FastFloatBuffer(int size)
Creates a new float buffer, with a buffer capacity of the specified size, in bytes.

Parameters:
size - the initial size.
Throws:
java.lang.IllegalArgumentException - if size is negative.
Method Detail

append

public FastFloatBuffer append(float[] array,
                              int off,
                              int len)
Appends float array to buffer.


append

public FastFloatBuffer append(float[] array)
Appends float array to buffer.


append

public FastFloatBuffer append(float element)
Appends single float to buffer.


append

public FastFloatBuffer append(FastFloatBuffer buff)
Appends another fast buffer to this one.


size

public int size()
Returns buffer size.


isEmpty

public boolean isEmpty()
Tests if this buffer has no elements.


index

public int index()
Returns current index of inner float array chunk. Represents the index of last used inner array chunk.


offset

public int offset()
Returns the offset of last used element in current inner array chunk.


array

public float[] array(int index)
Returns float inner array chunk at given index. May be used for iterating inner chunks in fast manner.


clear

public void clear()
Resets the buffer content.


toArray

public float[] toArray()
Creates float array from buffered content.


toArray

public float[] toArray(int start,
                       int len)
Creates float subarray from buffered content.


get

public float get(int index)
Returns float element at given index.



Copyright © 2003-2012 Jodd Team