|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.graphstream.stream.netstream.NetStreamReceiver
public class NetStreamReceiver
This class implements a receiver according to specifications the NetStream protocol.
See NetStreamConstants
for a full description of the protocol, the sender and the receiver.
NetStreamConstants
,
Copyright (c) 2010 University of Luxembourg
NetStreamReceiver.java
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
NetStreamReceiver(int port)
New NetStream Receiver, awaiting in its own thread at "localhost" on the given port, for new graph events. |
|
NetStreamReceiver(String hostname,
int port)
New NetStream Receiver, awaiting in its own thread at the given host name and port, for new graph events. |
|
NetStreamReceiver(String hostname,
int port,
boolean debug)
New NetStream Receiver, awaiting in its own thread at the given host name and port, for new graph events. |
Method Summary | |
---|---|
ThreadProxyPipe |
getDefaultStream()
Gives the default stream (a ThreadProxyPipe) identified with the name "default". |
ThreadProxyPipe |
getStream(String name)
Gives the stream (a ThreadProxyPipe) identified with this name. |
boolean |
hasActiveConnections()
Ask the receiver about its active connections |
boolean |
isRunning()
False as soon as the receiver terminates. |
void |
poll()
Wait until one or several chunks of message are acceptable. |
void |
quit()
Stop the receiver. |
void |
register(String name,
ThreadProxyPipe stream)
Register a stream. |
void |
removeUnpacker()
|
void |
run()
Wait for connections, accept them, demultiplexes them and dispatch messages to registered message boxes. |
void |
setDebugOn(boolean on)
Enable or disable debugging. |
void |
setUnpacker(NetStreamUnpacker unpaker)
Sets an optional NetStreamUnpaker whose "unpack" method will be called on each message. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public NetStreamReceiver(String hostname, int port) throws IOException, UnknownHostException
hostname
- The host name to listen at messages.port
- The port to listen at messages.
IOException
UnknownHostException
public NetStreamReceiver(int port) throws IOException, UnknownHostException
port
- The port to listen at messages.
IOException
UnknownHostException
public NetStreamReceiver(String hostname, int port, boolean debug) throws IOException, UnknownHostException
hostname
- The host name to listen at messages.port
- The port to listen at messages.debug
- If true informations are output for each message received.
IOException
UnknownHostException
Method Detail |
---|
public boolean isRunning()
public ThreadProxyPipe getStream(String name)
name
- Identifier of the stream.
public ThreadProxyPipe getDefaultStream()
public void setDebugOn(boolean on)
public void register(String name, ThreadProxyPipe stream) throws Exception
name
- Filter only message with this name to the given message box.stream
- The ThreadProxyPipe to push the events to.
Exception
- If another Pipe is already registered at the given name.public void quit()
public boolean hasActiveConnections()
public void setUnpacker(NetStreamUnpacker unpaker)
unpaker
- public void removeUnpacker()
public void run()
run
in interface Runnable
run
in class Thread
public void poll()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |