blob: bcf4829f493b1c136dab0edff199b3e965e6b0df [file] [log] [blame]
slowr60d4d102017-08-16 18:33:58 -07001/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -08004package org.onosproject.xran.asn1lib.ber.types.string;
slowr60d4d102017-08-16 18:33:58 -07005
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -08006import org.onosproject.xran.asn1lib.ber.BerByteArrayOutputStream;
7import org.onosproject.xran.asn1lib.ber.BerTag;
slowr60d4d102017-08-16 18:33:58 -07008
9import java.io.IOException;
10import java.io.InputStream;
11
12public class BerObjectDescriptor extends BerGraphicString {
13
14 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.PRIMITIVE, BerTag.OBJECT_DESCRIPTOR_TAG);
15 private static final long serialVersionUID = 1L;
16
17 public BerObjectDescriptor() {
18 }
19
20 public BerObjectDescriptor(byte[] value) {
21 super(value);
22 }
23
24 @Override
25 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
26
27 int codeLength;
28
29 codeLength = super.encode(os, false);
30 if (withTag) {
31 codeLength += tag.encode(os);
32 }
33
34 return codeLength;
35 }
36
37 @Override
38 public int decode(InputStream is, boolean withTag) throws IOException {
39
40 int codeLength = 0;
41
42 if (withTag) {
43 codeLength += tag.decodeAndCheck(is);
44 }
45
46 codeLength += super.decode(is, false);
47
48 return codeLength;
49 }
50
51}