sk.baka.ambient.stream.shoutcast
Class ShoutcastInputStream
java.lang.Object
java.io.InputStream
sk.baka.ambient.stream.shoutcast.ShoutcastInputStream
- All Implemented Interfaces:
- java.io.Closeable
public class ShoutcastInputStream
- extends java.io.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 |
java.net.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.io.InputStream |
available, mark, markSupported, reset, skip |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
url
public final java.net.URL url
- The SHOUTcast server URL.
ShoutcastInputStream
public ShoutcastInputStream(java.net.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(java.io.InputStream stream,
IShoutcastListener listener)
throws java.io.IOException
- Creates the object.
- Parameters:
stream - the SHOUTcast stream.listener - the listener.
- Throws:
java.io.IOException
read
public int read(byte[] b,
int offset,
int length)
throws java.io.IOException
- Overrides:
read in class java.io.InputStream
- Throws:
java.io.IOException
read
public int read()
throws java.io.IOException
- Specified by:
read in class java.io.InputStream
- Throws:
java.io.IOException
read
public int read(byte[] b)
throws java.io.IOException
- Overrides:
read in class java.io.InputStream
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close in interface java.io.Closeable- Overrides:
close in class java.io.InputStream
- Throws:
java.io.IOException
Copyright © 2007-2009. All Rights Reserved.