|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sk.baka.ambient.commons.SocketServer sk.baka.ambient.playerservice.StreamerServer
public final class StreamerServer
This class acts as a mp3 data feed for the MediaPlayer
component. It
acts as a very simple http server (handles GET requests on http://localhost:
5412/). The following paths are supported:
The port is opened immediately when the object is created. Use the
SocketServer.close()
method to close and cleanup the server.
Field Summary | |
---|---|
static int |
PORT
The port to listen on. |
Constructor Summary | |
---|---|
StreamerServer(PlayerService service)
Creates new server instance and opens the listen port. |
Method Summary | |
---|---|
static String |
getShoutcastStream(URL shoutcast)
Returns an URL which accesses given shoutcast radio. |
protected void |
handleRequest(Socket socket,
InputStream in,
OutputStream out)
Handles a request. |
Methods inherited from class sk.baka.ambient.commons.SocketServer |
---|
close, isStarted, newThread, onStopping, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int PORT
Constructor Detail |
---|
public StreamerServer(PlayerService service)
service
- Owning player service.Method Detail |
---|
public static String getShoutcastStream(URL shoutcast)
shoutcast
- the shoutcast radio URL
protected void handleRequest(Socket socket, InputStream in, OutputStream out) throws IOException, ServerHttpException
SocketServer
Thread.isInterrupted()
, terminating ASAP when
interrupted.
handleRequest
in class SocketServer
socket
- the socket for this request.in
- opened read pipe from the socket.out
- opened write pipe to the socket.
IOException
- if i/o error occurs.
ServerHttpException
- if HTTP error occurs. This error is written as a HTTP
response. If you decide to throw this error then make sure
that nothing was written yet to out
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |