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:
java.io.Closeable

public class MetaDataInputStream
extends java.io.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
 java.lang.String currentMeta
           
 java.lang.String lastMeta
           
 java.lang.String name
           
 int streamID
           
 int zeroMetasCurrent
           
 int zeroMetasLast
           
 
Method Summary
static MetaDataInputStream createMetaDataInputStream(java.net.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.
 java.lang.String readHeader()
           
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentMeta

public java.lang.String currentMeta

lastMeta

public java.lang.String lastMeta

zeroMetasLast

public int zeroMetasLast

zeroMetasCurrent

public int zeroMetasCurrent

streamID

public int streamID

name

public java.lang.String name
Method Detail

read

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

read

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

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.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 java.io.FilterInputStream
Throws:
java.io.IOException

readHeader

public java.lang.String readHeader()
                            throws java.io.IOException
Throws:
java.io.IOException

processHeader

public void processHeader()
                   throws java.io.IOException
Throws:
java.io.IOException

createMetaDataInputStream

public static MetaDataInputStream createMetaDataInputStream(java.net.URL source)
                                                     throws java.io.IOException
Throws:
java.io.IOException