|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.voytechs.jnetstream.codec.event.DecoderSupport
public class DecoderSupport
This is a dispatcher support class for Decoder decodes. This class maintains a list of listeners on certain events. When that event occures it is dispatched to all of the listeners. Events are fired off only when the entire structure is complete. For example when a Packet is created and all of the headers are added into it and no more Headers can be added to it, then as the last step event is fired off to all of the listeners. For Header event, it is fired only when the top-level header is completed. Any subheaders that are completed, but are being merged into the top level header do not generate events.
| Field Summary | |
|---|---|
static java.lang.String |
EVENT_ALL
|
| Constructor Summary | |
|---|---|
DecoderSupport()
Initializes the support object. |
|
| Method Summary | |
|---|---|
void |
addListener(DecoderListener listener)
Adds a new listener for all event types. |
void |
addListener(DecoderListener listener,
java.lang.String eventType)
Adds a new listener for a specific event type. |
void |
fireDecoderEvent(DecoderEvent event)
Fire event when new Packet is created and finalized. |
java.util.List |
getListeners(java.lang.String eventType)
Returns the list of listeners for specific event. |
java.util.List |
getListenersForAll()
Returns the list of listeners for all events. |
boolean |
hasListeners()
Returns true if support object has registered listeners. |
boolean |
hasListeners(java.lang.String eventType)
Returns true if support object has registered listeners for specific event. |
static void |
main(java.lang.String[] args)
Test function for DecoderSupport |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String EVENT_ALL
| Constructor Detail |
|---|
public DecoderSupport()
| Method Detail |
|---|
public void addListener(DecoderListener listener)
listener - Listener to dispatch. Every event will cause a dispatch
to the listener.DecoderEvent
public void addListener(DecoderListener listener,
java.lang.String eventType)
listener - Listener for the event.eventType - Event type to register the listener for. Only this
specific event will trigger a dispatch to the listener.public java.util.List getListeners(java.lang.String eventType)
eventType - The even type for which to get listeners. This list
will not include listeners that are listening to all events. Use
the method getListenersForAll() to get that list.
public java.util.List getListenersForAll()
public void fireDecoderEvent(DecoderEvent event)
throws AssertFailure
AssertFailurepublic boolean hasListeners()
public boolean hasListeners(java.lang.String eventType)
public static void main(java.lang.String[] args)
args - command line arguments
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||