View Javadoc

1   /*
2    Copyright 2006-2011 Abdulla Abdurakhmanov (abdulla@latestbit.com)
3    Original sources are available at www.latestbit.com
4   
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8   
9    http://www.apache.org/licenses/LICENSE-2.0
10  
11   Unless required by applicable law or agreed to in writing, software
12   distributed under the License is distributed on an "AS IS" BASIS,
13   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   See the License for the specific language governing permissions and
15   limitations under the License.
16   */
17  
18  package org.universAAL.lddi.lib.ieeex73std.org.bn.metadata;
19  
20  import java.io.InputStream;
21  import java.io.OutputStream;
22  
23  import org.universAAL.lddi.lib.ieeex73std.org.bn.annotations.ASN1Any;
24  import org.universAAL.lddi.lib.ieeex73std.org.bn.annotations.ASN1BitString;
25  import org.universAAL.lddi.lib.ieeex73std.org.bn.coders.DecodedObject;
26  import org.universAAL.lddi.lib.ieeex73std.org.bn.coders.ElementInfo;
27  import org.universAAL.lddi.lib.ieeex73std.org.bn.coders.IASN1TypesDecoder;
28  import org.universAAL.lddi.lib.ieeex73std.org.bn.coders.IASN1TypesEncoder;
29  
30  /**
31   * @author jcfinley@users.sourceforge.net
32   */
33  public class ASN1BitStringMetadata
34      extends ASN1FieldMetadata
35  {
36      public ASN1BitStringMetadata(String name)
37      {
38          super(name);
39      }
40      
41      public ASN1BitStringMetadata(ASN1BitString annotation) {
42          this(annotation.name());
43      }
44      
45      public int encode(IASN1TypesEncoder encoder, Object object, OutputStream stream, 
46                 ElementInfo elementInfo) throws Exception {
47          return encoder.encodeBitString(object, stream, elementInfo);
48      }
49      
50      public DecodedObject decode(IASN1TypesDecoder decoder, DecodedObject decodedTag, Class objectClass, ElementInfo elementInfo, InputStream stream) throws Exception {
51          return decoder.decodeBitString(decodedTag,objectClass,elementInfo,stream);
52      }
53      
54      
55  }