jodd.util.buffer
Class FastShortBuffer

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

public class FastShortBuffer
extends java.lang.Object

Fast, fast short buffer.


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

Constructor Detail

FastShortBuffer

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


FastShortBuffer

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


append

public FastShortBuffer append(short[] array)
Appends short array to buffer.


append

public FastShortBuffer append(short element)
Appends single short to buffer.


append

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


toArray

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


get

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



Copyright © 2003-2012 Jodd Team