jodd.util.buffer
Class FastBooleanBuffer

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

public class FastBooleanBuffer
extends java.lang.Object

Fast, fast boolean buffer.


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

Constructor Detail

FastBooleanBuffer

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


FastBooleanBuffer

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


append

public FastBooleanBuffer append(boolean[] array)
Appends boolean array to buffer.


append

public FastBooleanBuffer append(boolean element)
Appends single boolean to buffer.


append

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


toArray

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


get

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



Copyright © 2003-2012 Jodd Team