jodd.util.buffer
Class FastIntBuffer

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

public class FastIntBuffer
extends java.lang.Object

Fast, fast int buffer.


Constructor Summary
FastIntBuffer()
          Creates a new int buffer.
FastIntBuffer(int size)
          Creates a new int buffer, with a buffer capacity of the specified size, in bytes.
 
Method Summary
 FastIntBuffer append(FastIntBuffer buff)
          Appends another fast buffer to this one.
 FastIntBuffer append(int element)
          Appends single int to buffer.
 FastIntBuffer append(int[] array)
          Appends int array to buffer.
 FastIntBuffer append(int[] array, int off, int len)
          Appends int array to buffer.
 int[] array(int index)
          Returns int inner array chunk at given index.
 void clear()
          Resets the buffer content.
 int get(int index)
          Returns int element at given index.
 int index()
          Returns current index of inner int 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.
 int[] toArray()
          Creates int array from buffered content.
 int[] toArray(int start, int len)
          Creates int subarray from buffered content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FastIntBuffer

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


FastIntBuffer

public FastIntBuffer(int size)
Creates a new int 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 FastIntBuffer append(int[] array,
                            int off,
                            int len)
Appends int array to buffer.


append

public FastIntBuffer append(int[] array)
Appends int array to buffer.


append

public FastIntBuffer append(int element)
Appends single int to buffer.


append

public FastIntBuffer append(FastIntBuffer 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 int 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 int[] array(int index)
Returns int 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 int[] toArray()
Creates int array from buffered content.


toArray

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


get

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



Copyright © 2003-2012 Jodd Team