|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.directory.shared.asn1.codec.stateful.CallbackHistory
A convenience callback which collects decoded or encoded objects to audit a codecs's activity. The callback also comes in handy when data is to be pushed through a codec and grabed immediately afterwords to serialize codec operation.
Field Summary | |
private java.util.LinkedList |
history
history of decoded objects in cronological order |
private int |
length
the length of callback history stored |
Constructor Summary | |
CallbackHistory()
Creates an auditing callback that manages a history of indefinite length. |
|
CallbackHistory(int length)
Creates an auditing callback that manages a history of fixed or indefinite length. |
Method Summary | |
void |
clear()
Clears the history of decoded items. |
void |
decodeOccurred(StatefulDecoder decoder,
java.lang.Object decoded)
Callback to deliver a fully decoded object. |
void |
encodeOccurred(StatefulEncoder encoder,
java.lang.Object encoded)
Callback to deliver a fully encoded object. |
java.lang.Object |
getMostRecent()
Gets the most recent decoded object if one exists. |
java.lang.Object |
getOldest()
Gets the oldest decoded object if one exists. |
boolean |
isEmpty()
Tests to see if the history is empty. |
int |
size()
Gets the number of decoded items in the callback history. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private final java.util.LinkedList history
private final int length
Constructor Detail |
public CallbackHistory()
public CallbackHistory(int length)
length
- the maximum length of callback history to store before
dropping decoded items, a length of zero or 1 corresponds to
indefinite historyMethod Detail |
public void decodeOccurred(StatefulDecoder decoder, java.lang.Object decoded)
DecoderCallback
decodeOccurred
in interface DecoderCallback
decoder
- the stateful decoder driving the callbackdecoded
- the object that was decodedpublic void encodeOccurred(StatefulEncoder encoder, java.lang.Object encoded)
encodeOccurred
in interface EncoderCallback
encoder
- the stateful encoder driving the callbackencoded
- the object that was encodedpublic java.lang.Object getMostRecent()
java.util.NoSuchElementException
- if the history is emptypublic java.lang.Object getOldest()
java.util.NoSuchElementException
- if the history is emptypublic boolean isEmpty()
public void clear()
public int size()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |