01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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.apache.harmony.jndi.provider.ldap.asn1;
19:
20: /**
21: * This interface is responsible for encoding data according to ASN.1 type schema.
22: * Below is type mapping between ASN.1 and Java.
23: * <p>
24: * Note: the mapping of SEQUENCE and CHOICE is supported only when using
25: * corresponding wrapped class ASN1SequenceWrap and ASN1ChoiceWrap
26: * <p>
27: * <code>
28: * ASN.1 Java
29: * BOOLEAN Boolean
30: * INTEGER byte[] (encode: ASN1Integer.fromIntValue(int value) decode: ASN1Integer.toIntValue(Object decoded))
31: * OCTET STRING byte[] (encode: Utils.getBytes(String s) decode: getString(byte[] bytes))
32: * ENUMERATED byte[] (encode: ASN1Integer.fromIntValue(int value) decode: ASN1Integer.toIntValue(Object decoded))
33: * SEQUENCE Object[] or ASN1Encodable
34: * SEQUENCE OF java.util.List
35: * SET OF java.util.List
36: * CHOICE Object[] or ChosenValue
37: * </code>
38: *
39: * @see org.apache.harmony.jndi.provider.ldap.asn1.ASN1ChoiceWrap
40: * @see org.apache.harmony.jndi.provider.ldap.asn1.ASN1SequenceWrap
41: */
42: public interface ASN1Encodable {
43:
44: /**
45: * Encodes data into <code>values</code>. It is caller's responsibility
46: * to create <code>values</code> array, and the size of
47: * <code>values</code> is defined by the ASN.1 type schema which is to be
48: * encoded. Classes realize this interface need to fill encoded value into
49: * the <code>values</code> array.
50: *
51: * @param values
52: */
53: public void encodeValues(Object[] values);
54: }
|