com.petersalomonsen.jjack.javasound
Class ByteIntConverter

java.lang.Object
  extended by com.petersalomonsen.jjack.javasound.ByteIntConverter

public final class ByteIntConverter
extends java.lang.Object

Convert 8,16,24 and 32 bit integers (stored as bytes) to and from integer variables

Version:
0.3
Author:
Peter Johan Salomonsen

Field Summary
(package private)  boolean bigEndian
           
(package private)  int bytesPerSample
          Use final for inline optimization
(package private)  int msbIndex
           
(package private)  boolean signed
           
 
Constructor Summary
ByteIntConverter(int bytesPerSample, boolean bigEndian, boolean signed)
           
 
Method Summary
 int readInt(byte[] bytes, int index)
          Read from the byte array into an integer
 void writeInt(byte[] bytes, int index, int value)
          Write an integer into the byte array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bytesPerSample

final int bytesPerSample
Use final for inline optimization


bigEndian

final boolean bigEndian

signed

final boolean signed

msbIndex

final int msbIndex
Constructor Detail

ByteIntConverter

public ByteIntConverter(int bytesPerSample,
                        boolean bigEndian,
                        boolean signed)
Method Detail

readInt

public final int readInt(byte[] bytes,
                         int index)
Read from the byte array into an integer


writeInt

public final void writeInt(byte[] bytes,
                           int index,
                           int value)
Write an integer into the byte array