javaFlacEncoder
Class EncodedElement_32

java.lang.Object
  extended by javaFlacEncoder.EncodedElement
      extended by javaFlacEncoder.EncodedElement_32

public class EncodedElement_32
extends EncodedElement

EncodedElement which uses an integer array as a backing, rather than the byte array.

Author:
Preston Lacey

Field Summary
 
Fields inherited from class javaFlacEncoder.EncodedElement
offset
 
Constructor Summary
EncodedElement_32()
           
EncodedElement_32(int size, int off)
           
 
Method Summary
 EncodedElement addInt(int input, int bitCount)
          Add a number of bits from an int to the end of this list's data.
static void addInt(int value, int count, int startPos, int[] dest)
          This method adds a given number of bits of an int to a byte array.
 void clear(int size, int off)
          Completely clear this element and use the given size and offset for the new data array.
 EncodedElement convertToEncodedElement()
           
 byte[] getData()
          Get the byte array stored by this object(null if not set).
 int[] getData32()
           
 EncodedElement packIntByBits(int[] inputA, int[] inputBits, int inputOffset, int countA)
          Pack a number of bits from each int of an array(within given limits)to the end of this list.
static void packIntByBits(int[] inputA, int[] inputBits, int inputOffset, int countA, int startPosIn, int[] dest)
          Pack a number of bits from each int of an array(within given limits)to the end of this list.
 
Methods inherited from class javaFlacEncoder.EncodedElement
addInt, addLong, addLong, attachEnd, clear, getCRC16, getEnd_S, getEnd, getTotalBits, packInt, packInt, packIntByBits, padToByte, print, print
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncodedElement_32

public EncodedElement_32()

EncodedElement_32

public EncodedElement_32(int size,
                         int off)
Method Detail

clear

public void clear(int size,
                  int off)
Description copied from class: EncodedElement
Completely clear this element and use the given size and offset for the new data array.

Overrides:
clear in class EncodedElement
Parameters:
size - Size of data array to use(in bytes)
off - Offset to use for this element. Usablebits will also be set to this value.

addInt

public static void addInt(int value,
                          int count,
                          int startPos,
                          int[] dest)
This method adds a given number of bits of an int to a byte array.

Parameters:
value - int to store bits from
count - number of low-order bits to store
startPos - start bit location in array to begin writing
dest - array to store bits in. dest MUST have enough space to store the given data, or this function will fail.

getData32

public int[] getData32()

packIntByBits

public static void packIntByBits(int[] inputA,
                                 int[] inputBits,
                                 int inputOffset,
                                 int countA,
                                 int startPosIn,
                                 int[] dest)
Pack a number of bits from each int of an array(within given limits)to the end of this list.

Parameters:
inputA - Array containing input values.
inputBits - Array containing number of bits to use for each index packed. This array should be equal in size to the inputA array.
inputOffset - Index of first usable index.
countA - Number of indices to pack.
startPosIn - First usable bit-level index in destination array(byte index = startPosIn/8, bit within that byte = startPosIn%8)
dest - Destination array to store input values in. This array *must* be large enough to store all values or this method will fail in an undefined manner.

packIntByBits

public EncodedElement packIntByBits(int[] inputA,
                                    int[] inputBits,
                                    int inputOffset,
                                    int countA)
Pack a number of bits from each int of an array(within given limits)to the end of this list.

Overrides:
packIntByBits in class EncodedElement
Parameters:
inputA - Array containing input values.
inputBits - Array containing number of bits to use for each index packed. This array should be equal in size to the inputA array.
inputOffset - Index of first usable index.
countA - Number of indices to pack.
Returns:
EncodedElement containing end of packed data. Data may flow between multiple EncodedElement's, if an existing element was not large enough for all values.

getData

public byte[] getData()
Description copied from class: EncodedElement
Get the byte array stored by this object(null if not set).


convertToEncodedElement

public EncodedElement convertToEncodedElement()

addInt

public EncodedElement addInt(int input,
                             int bitCount)
Add a number of bits from an int to the end of this list's data. Will add a new element if necessary. The bits stored are taken from the lower- order of input.

Overrides:
addInt in class EncodedElement
Parameters:
input - Int containing bits to append to end.
bitCount - Number of bits to append.
Returns:
EncodedElement which actually contains the appended value.