sk.baka.ambient.stream.shoutcast
Class ShoutcastInputStream
java.lang.Object
java.io.InputStream
sk.baka.ambient.stream.shoutcast.ShoutcastInputStream
- All Implemented Interfaces:
- Closeable
public class ShoutcastInputStream
- extends InputStream
Polls a SHOUTcast server on given URL address. The stream itself will contain
mp3 data only - all shoutcast-related metadata are reported as events and
filtered out.
Throws RadioStreamCorruptedException
when the stream corruption is
detected.
- Author:
- Martin Vysny
Field Summary |
URL |
url
The SHOUTcast server URL. |
Method Summary |
void |
close()
|
int |
read()
|
int |
read(byte[] b)
|
int |
read(byte[] b,
int offset,
int length)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
url
public final URL url
- The SHOUTcast server URL.
ShoutcastInputStream
public ShoutcastInputStream(URL url,
IShoutcastListener listener)
- Creates the object. The SHOUTcast server is polled on first invocation of
the
read
method.
- Parameters:
url
- the server URL, must be a http (or file - for debugging
purposes) protocol.listener
- the listener.
ShoutcastInputStream
ShoutcastInputStream(InputStream stream,
IShoutcastListener listener)
throws IOException
- Creates the object.
- Parameters:
stream
- the SHOUTcast stream.listener
- the listener.
- Throws:
IOException
read
public int read(byte[] b,
int offset,
int length)
throws IOException
- Overrides:
read
in class InputStream
- Throws:
IOException
read
public int read()
throws IOException
- Specified by:
read
in class InputStream
- Throws:
IOException
read
public int read(byte[] b)
throws IOException
- Overrides:
read
in class InputStream
- Throws:
IOException
close
public void close()
throws IOException
- Specified by:
close
in interface Closeable
- Overrides:
close
in class InputStream
- Throws:
IOException
Copyright © 2007-2008. All Rights Reserved.