jodd.util.buffer
Class FastLongBuffer

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

public class FastLongBuffer
extends java.lang.Object

Fast, fast long buffer.


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

Constructor Detail

FastLongBuffer

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


FastLongBuffer

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


append

public FastLongBuffer append(long[] array)
Appends long array to buffer.


append

public FastLongBuffer append(long element)
Appends single long to buffer.


append

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


toArray

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


get

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



Copyright © 2003-2012 Jodd Team