1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.asn1.codec.stateful ;
18
19
20 import org.apache.asn1.codec.DecoderException;
21
22
23 /***
24 * A decoder which decodes encoded data as it arrives in peices while
25 * maintaining the state of the decode operation between the arrival of
26 * encoded chunks.
27 *
28 * As chunks of encoded data arrive the decoder processes each chunk of encoded
29 * data and maintains decoding state in between arrivals: it is hence stateful
30 * and should be associated with a single channel or encoded data producer.
31 * When an arbitrary unit of encoding, to be determined by the encoding scheme,
32 * has been decoded, the <code>decode()</code> method of the registered
33 * DecoderCallback is called.
34 *
35 * @author <a href="mailto:commons-dev@jakarta.apache.org">Jakarta Commons</a>
36 * @version $Rev: 161723 $
37 */
38 public interface StatefulDecoder
39 {
40 /***
41 * Decodes a peice of encoded data. The nature of this call, synchronous
42 * verses asynchonous, with respect to driving the actual decoding of the
43 * encoded data argument is determined by an implementation. A return from
44 * this method does not guarrantee any callbacks: zero or more callbacks
45 * may occur during this call.
46 *
47 * @param encoded an object representing a peice of encoded data
48 */
49 void decode( Object encoded ) throws DecoderException ;
50
51 /***
52 * Sets the callback for this StatefulDecoder.
53 *
54 * @param cb the callback to inform of a complete decode operation
55 */
56 void setCallback( DecoderCallback cb ) ;
57
58 /***
59 * Monitors all kinds of events that occur during processing.
60 *
61 * @param monitor to set for this StatefulDecoder
62 */
63 void setDecoderMonitor( DecoderMonitor monitor ) ;
64 }