View Javadoc

1   /*
2    *   Copyright 2004 The Apache Software Foundation
3    *
4    *   Licensed under the Apache License, Version 2.0 (the "License");
5    *   you may not use this file except in compliance with the License.
6    *   You may obtain a copy of the License at
7    *
8    *       http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *   Unless required by applicable law or agreed to in writing, software
11   *   distributed under the License is distributed on an "AS IS" BASIS,
12   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *   See the License for the specific language governing permissions and
14   *   limitations under the License.
15   *
16   */
17  package org.apache.asn1.codec.stateful;
18  
19  
20  
21  
22  /***
23   * Document me.
24   * 
25   * @author <a href="mailto:dev@directory.apache.org"> Apache Directory
26   *         Project</a> $Rev: 161723 $
27   */
28  public class EncoderMonitorAdapter implements EncoderMonitor
29  {
30      /***
31       * Receive notification of a recoverable error.  This callback is used to
32       * denote a failure to handle a unit of data to be encoded or decoded.  The
33       * entire [en|de]codable unit is lost but the [en|de]coding operation can
34       * still proceed.
35       *
36       * @param encoder   the encoder that had the error
37       * @param exception the error information encapsulated in an exception
38       */
39      public void error( StatefulEncoder encoder, Exception exception )
40      {
41      }
42  
43      /***
44       * Receive notification of a non-recoverable error.  The application must
45       * assume that the stream data is unusable after the encoder has invoked
46       * this method, and should continue (if at all) only for the sake of
47       * collecting addition error messages: in fact, encoders are free to stop
48       * reporting any other events once this method has been invoked.
49       *
50       * @param encoder   the encoder that had the failure
51       * @param exception the warning information encapsulated in an exception
52       */
53      public void fatalError( StatefulEncoder encoder, Exception exception )
54      {
55      }
56  
57      /***
58       * Receive notification of a warning.  The encoder must continue to provide
59       * normal callbacks after invoking this method: it should still be possible
60       * for the application to process the encoded data through to the end.
61       *
62       * @param encoder   the encoder that had the error
63       * @param exception the warning information encapsulated in an exception
64       */
65      public void warning( StatefulEncoder encoder, Exception exception )
66      {
67      }
68  
69      /***
70       * Monitors callbacks that deliver a fully decoded object.
71       *
72       * @param encoder the stateful encoder driving the callback
73       * @param decoded the object that was decoded
74       */
75      public void callbackOccured( StatefulEncoder encoder, EncoderCallback cb, Object decoded )
76      {
77      }
78  
79      /***
80       * Monitors changes to the callback.
81       *
82       * @param encoder the encoder whose callback was set
83       * @param oldcb   the unset old callback, or null if none was set
84       * @param newcb   the newly set callback, or null if callback is cleared
85       */
86      public void callbackSet( StatefulEncoder encoder, EncoderCallback oldcb, EncoderCallback newcb )
87      {
88      }
89  }