comirva.audio.util
Class MetaDataInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
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