org.tritonus.lowlevel.gsm
Class Encoder

java.lang.Object
  extended byorg.tritonus.lowlevel.gsm.Encoder

public class Encoder
extends Object


Constructor Summary
Encoder()
          Encoder class constructor.
 
Method Summary
 void encode(InputStream input, String output_file)
          Encode the specified InputStream.
 void encode(short[] asBuffer, byte[] abFrame)
          Encodes a block of data.
 void encode(String input_file, String output_file)
          Encode the specified file.
static void stripAUHeader(InputStream in)
          Remove the header info from the stream and verifies the file type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Encoder

public Encoder()
Encoder class constructor.

Method Detail

stripAUHeader

public static void stripAUHeader(InputStream in)
                          throws Exception
Remove the header info from the stream and verifies the file type. As defined by the NeXT/Sun audio file format U-law (.au). For more info see the README file.

Note: Most of this info is not needed to reproduce the sound file after encoding. All that is needed is the magic number and the sampling rate to reproduce the sound file during decoding.

Parameters:
in - Strip the header from a Sun/Next formated sound stream.
Throws:
Exception

encode

public void encode(String input_file,
                   String output_file)
            throws Exception
Encode the specified file.
This method calls the stripAUHeader method for you.
stripAUHeader will verify file type.

Parameters:
input_file - The name of the file to encode.
output_file - The name of the GSM encoded file.
Throws:
Exception

encode

public void encode(InputStream input,
                   String output_file)
            throws IOException
Encode the specified InputStream.

Parameters:
input - The stream to encode.
output_file - The name of the GSM encoded file.
Throws:
IOException

encode

public void encode(short[] asBuffer,
                   byte[] abFrame)
Encodes a block of data.

Parameters:
asBuffer - an 160-element array with the data to encode int PCM 16 bit format.
abFrame - the encoded GSM frame (33 bytes).