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.ber.digester ;
18  
19  
20  import java.nio.ByteBuffer;
21  
22  import org.apache.asn1.ber.TypeClass;
23  
24  
25  /***
26   * A BER event processing rule.
27   *
28   * @author <a href="mailto:dev@directory.apache.org">
29   * Apache Directory Project</a>
30   * @version $Rev: 157644 $
31   */
32  public interface Rule
33  {
34      /***
35       * Get the <code>BERDigester</code> with which this <code>Rule</code> has
36       * been associated.
37       * 
38       * @return the associated rulesBase
39       */
40      BERDigester getDigester() ;
41      
42      /***
43       * Set the <code>BERDigester</code> with which this <code>Rule</code> will
44       * be associated.
45       * 
46       * @param digester the rulesBase to associate this rule with
47       */
48      void setDigester( BERDigester digester ) ;
49      
50      /***
51       * Called when the tag of the matched TLV is encountered.
52       * 
53       * @param id the tag's id 
54       * @param isPrimitive whether tlv is primitive or constructed
55       * @param typeClass the tag's type class
56       */
57      void tag( int id, boolean isPrimitive, TypeClass typeClass ) ;
58      
59      /***
60       * Called when the length of a TLV is encountered.
61       * 
62       * @param length the length in bytes of the value
63       */
64      void length( int length ) ;
65      
66      /***
67       * Called when a peice of the value is available.
68       * 
69       * @param buf a portion of the value
70       */
71      void value( ByteBuffer buf ) ;
72      
73      /***
74       * Called when the tlv has been completely consumed.
75       */
76      void finish() ;
77  }