comirva.audio.util
Class MetaDataInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by comirva.audio.util.MetaDataInputStream
All Implemented Interfaces:
Closeable

public class MetaDataInputStream
extends FilterInputStream

Überschrift:

Beschreibung:

This class provides a way to split metadata from audiostream, which support the Shoutcast Metadata Protocol. The resulting stream equals the InputStream handed in, except that all metadata infos have been removed. Normally internet radio streams are encoded. Therefore these streams should be passed on to the Java Sound API, which will try to decode the given stream using the installed codecs.
Attention: Wrap this Stream with a BufferedInputStream to yield a smooth decoding into a pcm audio stream.
To create an MetaDataInputStream directly based on an URL use the factory method createMetaDataInputStream(). You might also wrap the BufferedInputStream with a ReducedAudioInputStream if you want to analyze this stream using the comirva.audio package.


Field Summary
 String currentMeta
           
 String lastMeta
           
(package private)  int metaint
           
(package private)  int metapos
           
 String name
           
(package private)  int next
           
(package private) static int nextStreamID
           
 int streamID
           
 int zeroMetasCurrent
           
 int zeroMetasLast
           
 
Fields inherited from class java.io.FilterInputStream
in
 
Method Summary
static MetaDataInputStream createMetaDataInputStream(URL source)
           
 void processHeader()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
          This read method splits the metadata from the mp3 stream.
 String readHeader()
           
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentMeta

public String currentMeta

lastMeta

public String lastMeta

zeroMetasLast

public int zeroMetasLast

zeroMetasCurrent

public int zeroMetasCurrent

metaint

int metaint

next

int next

nextStreamID

static int nextStreamID

streamID

public int streamID

name

public String name

metapos

int metapos
Method Detail

read

public int read()
         throws IOException
Overrides:
read in class FilterInputStream
Throws:
IOException

read

public int read(byte[] b)
         throws IOException
Overrides:
read in class FilterInputStream
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
This read method splits the metadata from the mp3 stream. The metadata infos are sent every metaint bytes. The first byte after metaint bytes of mp3 data indicates the length of the metadata message.

Overrides:
read in class FilterInputStream
Throws:
IOException

readHeader

public String readHeader()
                  throws IOException
Throws:
IOException

processHeader

public void processHeader()
                   throws IOException
Throws:
IOException

createMetaDataInputStream

public static MetaDataInputStream createMetaDataInputStream(URL source)
                                                     throws IOException
Throws:
IOException