use of org.openmuc.jasn1.ber.BerTag in project jasn1 by openmuc.
the class BerClassWriter method writeChoiceDecodeFunction.
private void writeChoiceDecodeFunction(List<AsnElementType> componentTypes, boolean hasExplicitTag) throws IOException {
if (hasExplicitTag) {
writeSimpleDecodeFunction("true");
write("public int decode(InputStream is, boolean withTag) throws IOException {");
write("int codeLength = 0;");
write("BerLength length = new BerLength();");
write("BerTag berTag = new BerTag();\n");
write("if (withTag) {");
write("codeLength += tag.decodeAndCheck(is);");
write("}\n");
write("codeLength += length.decode(is);");
write("codeLength += berTag.decode(is);\n");
} else {
writeSimpleDecodeFunction("null");
write("public int decode(InputStream is, BerTag berTag) throws IOException {\n");
write("int codeLength = 0;");
write("BerTag passedTag = berTag;\n");
write("if (berTag == null) {");
write("berTag = new BerTag();");
write("codeLength += berTag.decode(is);");
write("}\n");
}
// TODO rename "choiceDecodeLength" because it could also be of type ANY
String initChoiceDecodeLength = "int ";
for (int j = 0; j < componentTypes.size(); j++) {
AsnElementType componentType = componentTypes.get(j);
String explicitEncoding = getExplicitDecodingParameter(componentType);
Tag componentTag = getTag(componentType);
if (componentTag != null) {
write("if (berTag.equals(" + getBerTagParametersString(componentTag) + ")) {");
if (componentTag.type == TagType.EXPLICIT) {
write("codeLength += BerLength.skip(is);");
}
write(getName(componentType) + " = new " + getClassNameOfComponent(componentType) + "();");
write("codeLength += " + getName(componentType) + ".decode(is" + explicitEncoding + ");");
write("return codeLength;");
write("}\n");
} else {
if (isDirectAnyOrChoice(componentType)) {
write(getName(componentType) + " = new " + getClassNameOfComponent(componentType) + "();");
write(initChoiceDecodeLength + "choiceDecodeLength = " + getName(componentType) + ".decode(is" + explicitEncoding + ");");
initChoiceDecodeLength = "";
write("if (choiceDecodeLength != 0) {");
write("return codeLength + choiceDecodeLength;");
write("}");
write("else {");
write(getName(componentType) + " = null;");
write("}\n");
} else {
write("if (berTag.equals(" + getClassNameOfComponent(componentType) + ".tag)) {");
write(getName(componentType) + " = new " + getClassNameOfComponent(componentType) + "();");
write("codeLength += " + getName(componentType) + ".decode(is" + explicitEncoding + ");");
write("return codeLength;");
write("}\n");
}
}
}
if (!hasExplicitTag) {
write("if (passedTag != null) {");
write("return 0;");
write("}\n");
}
write("throw new IOException(\"Error decoding CHOICE: Tag \" + berTag + \" matched to no item.\");");
write("}\n");
}
use of org.openmuc.jasn1.ber.BerTag in project jasn1 by openmuc.
the class PersonnelRecord method decode.
public int decode(InputStream is, boolean withTag) throws IOException {
int codeLength = 0;
int subCodeLength = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
if (totalLength == -1) {
subCodeLength += berTag.decode(is);
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
if (berTag.equals(Name.tag)) {
name = new Name();
subCodeLength += name.decode(is, false);
subCodeLength += berTag.decode(is);
}
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
title = new BerVisibleString();
subCodeLength += title.decode(is, false);
subCodeLength += berTag.decode(is);
}
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
if (berTag.equals(org.openmuc.jasn1.compiler.modules.module2.EmployeeNumberZ.tag)) {
number = new org.openmuc.jasn1.compiler.modules.module2.EmployeeNumberZ();
subCodeLength += number.decode(is, false);
subCodeLength += berTag.decode(is);
}
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
dateOfHire = new Date();
subCodeLength += dateOfHire.decode(is, false);
subCodeLength += berTag.decode(is);
}
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
nameOfSpouse = new Name();
subCodeLength += nameOfSpouse.decode(is, false);
subCodeLength += berTag.decode(is);
}
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) {
children = new Children();
subCodeLength += children.decode(is, false);
subCodeLength += berTag.decode(is);
}
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) {
testBitString = new MyBitString();
subCodeLength += testBitString.decode(is, false);
subCodeLength += berTag.decode(is);
}
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) {
test = new MyInt();
subCodeLength += test.decode(is, false);
subCodeLength += berTag.decode(is);
}
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
test2 = new TestChoice();
int choiceDecodeLength = test2.decode(is, berTag);
if (choiceDecodeLength != 0) {
subCodeLength += choiceDecodeLength;
subCodeLength += berTag.decode(is);
} else {
test2 = null;
}
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
test3 = new TestChoice();
choiceDecodeLength = test3.decode(is, berTag);
if (choiceDecodeLength != 0) {
subCodeLength += choiceDecodeLength;
subCodeLength += berTag.decode(is);
} else {
test3 = null;
}
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 8)) {
subCodeLength += length.decode(is);
test4 = new TestChoice();
choiceDecodeLength = test4.decode(is, null);
if (choiceDecodeLength != 0) {
subCodeLength += choiceDecodeLength;
subCodeLength += berTag.decode(is);
} else {
test4 = null;
}
}
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 9)) {
subCodeLength += length.decode(is);
test5 = new TestChoice();
choiceDecodeLength = test5.decode(is, null);
if (choiceDecodeLength != 0) {
subCodeLength += choiceDecodeLength;
subCodeLength += berTag.decode(is);
} else {
test5 = null;
}
}
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 10)) {
subCodeLength += length.decode(is);
test6 = new TestChoice();
choiceDecodeLength = test6.decode(is, null);
if (choiceDecodeLength != 0) {
subCodeLength += choiceDecodeLength;
subCodeLength += berTag.decode(is);
} else {
test6 = null;
}
}
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
employeeNumberZ = new EmployeeNumberZ();
choiceDecodeLength = employeeNumberZ.decode(is, berTag);
if (choiceDecodeLength != 0) {
subCodeLength += choiceDecodeLength;
subCodeLength += berTag.decode(is);
} else {
employeeNumberZ = null;
}
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
if (berTag.equals(BerVisibleString.tag)) {
code_ = new BerVisibleString();
subCodeLength += code_.decode(is, false);
subCodeLength += berTag.decode(is);
}
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
if (berTag.equals(TestSequenceOf.tag)) {
testSequenceOf = new TestSequenceOf();
subCodeLength += testSequenceOf.decode(is, false);
subCodeLength += berTag.decode(is);
}
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
if (berTag.equals(TestSequenceOf2.tag)) {
testSequenceOf2 = new TestSequenceOf2();
subCodeLength += testSequenceOf2.decode(is, false);
subCodeLength += berTag.decode(is);
}
if (berTag.tagNumber == 0 && berTag.tagClass == 0 && berTag.primitive == 0) {
int nextByte = is.read();
if (nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
if (berTag.equals(BerEmbeddedPdv.tag)) {
embeddedPdv = new BerEmbeddedPdv();
subCodeLength += embeddedPdv.decode(is, false);
subCodeLength += berTag.decode(is);
}
int nextByte = is.read();
if (berTag.tagNumber != 0 || berTag.tagClass != 0 || berTag.primitive != 0 || nextByte != 0) {
if (nextByte == -1) {
throw new EOFException("Unexpected end of input stream.");
}
throw new IOException("Decoded sequence has wrong end of contents octets");
}
codeLength += subCodeLength + 1;
return codeLength;
}
codeLength += totalLength;
subCodeLength += berTag.decode(is);
if (berTag.equals(Name.tag)) {
name = new Name();
subCodeLength += name.decode(is, false);
subCodeLength += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 0)) {
title = new BerVisibleString();
subCodeLength += title.decode(is, false);
subCodeLength += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
}
if (berTag.equals(org.openmuc.jasn1.compiler.modules.module2.EmployeeNumberZ.tag)) {
number = new org.openmuc.jasn1.compiler.modules.module2.EmployeeNumberZ();
subCodeLength += number.decode(is, false);
subCodeLength += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
dateOfHire = new Date();
subCodeLength += dateOfHire.decode(is, false);
subCodeLength += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
nameOfSpouse = new Name();
subCodeLength += nameOfSpouse.decode(is, false);
subCodeLength += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) {
children = new Children();
subCodeLength += children.decode(is, false);
subCodeLength += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 4)) {
testBitString = new MyBitString();
subCodeLength += testBitString.decode(is, false);
subCodeLength += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) {
test = new MyInt();
subCodeLength += test.decode(is, false);
subCodeLength += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
}
test2 = new TestChoice();
int choiceDecodeLength = test2.decode(is, berTag);
if (choiceDecodeLength != 0) {
subCodeLength += choiceDecodeLength;
subCodeLength += berTag.decode(is);
} else {
test2 = null;
}
test3 = new TestChoice();
subCodeLength += test3.decode(is, berTag);
subCodeLength += berTag.decode(is);
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 8)) {
subCodeLength += length.decode(is);
test4 = new TestChoice();
subCodeLength += test4.decode(is, null);
subCodeLength += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 9)) {
subCodeLength += length.decode(is);
test5 = new TestChoice();
subCodeLength += test5.decode(is, null);
subCodeLength += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 10)) {
subCodeLength += length.decode(is);
test6 = new TestChoice();
subCodeLength += test6.decode(is, null);
subCodeLength += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
}
employeeNumberZ = new EmployeeNumberZ();
choiceDecodeLength = employeeNumberZ.decode(is, berTag);
if (choiceDecodeLength != 0) {
subCodeLength += choiceDecodeLength;
subCodeLength += berTag.decode(is);
} else {
employeeNumberZ = null;
}
if (berTag.equals(BerVisibleString.tag)) {
code_ = new BerVisibleString();
subCodeLength += code_.decode(is, false);
subCodeLength += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
}
if (berTag.equals(TestSequenceOf.tag)) {
testSequenceOf = new TestSequenceOf();
subCodeLength += testSequenceOf.decode(is, false);
subCodeLength += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
}
if (berTag.equals(TestSequenceOf2.tag)) {
testSequenceOf2 = new TestSequenceOf2();
subCodeLength += testSequenceOf2.decode(is, false);
subCodeLength += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
}
if (berTag.equals(BerEmbeddedPdv.tag)) {
embeddedPdv = new BerEmbeddedPdv();
subCodeLength += embeddedPdv.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
}
}
throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
}
use of org.openmuc.jasn1.ber.BerTag in project jasn1 by openmuc.
the class DistributionPointName method decode.
public int decode(InputStream is, BerTag berTag) throws IOException {
int codeLength = 0;
BerTag passedTag = berTag;
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
fullName = new GeneralNames();
codeLength += fullName.decode(is, false);
return codeLength;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
nameRelativeToCRLIssuer = new RelativeDistinguishedName();
codeLength += nameRelativeToCRLIssuer.decode(is, false);
return codeLength;
}
if (passedTag != null) {
return 0;
}
throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item.");
}
use of org.openmuc.jasn1.ber.BerTag in project jasn1 by openmuc.
the class GeneralName method decode.
public int decode(InputStream is, BerTag berTag) throws IOException {
int codeLength = 0;
BerTag passedTag = berTag;
if (berTag == null) {
berTag = new BerTag();
codeLength += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
otherName = new AnotherName();
codeLength += otherName.decode(is, false);
return codeLength;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
rfc822Name = new BerIA5String();
codeLength += rfc822Name.decode(is, false);
return codeLength;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
dNSName = new BerIA5String();
codeLength += dNSName.decode(is, false);
return codeLength;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) {
x400Address = new ORAddress();
codeLength += x400Address.decode(is, false);
return codeLength;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) {
codeLength += BerLength.skip(is);
directoryName = new Name();
codeLength += directoryName.decode(is, null);
return codeLength;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 5)) {
ediPartyName = new EDIPartyName();
codeLength += ediPartyName.decode(is, false);
return codeLength;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 6)) {
uniformResourceIdentifier = new BerIA5String();
codeLength += uniformResourceIdentifier.decode(is, false);
return codeLength;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 7)) {
iPAddress = new BerOctetString();
codeLength += iPAddress.decode(is, false);
return codeLength;
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 8)) {
registeredID = new BerObjectIdentifier();
codeLength += registeredID.decode(is, false);
return codeLength;
}
if (passedTag != null) {
return 0;
}
throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item.");
}
use of org.openmuc.jasn1.ber.BerTag in project jasn1 by openmuc.
the class BerEmbeddedPdv method decode.
public int decode(InputStream is, boolean withTag) throws IOException {
int codeLength = 0;
int subCodeLength = 0;
BerTag berTag = new BerTag();
if (withTag) {
codeLength += tag.decodeAndCheck(is);
}
BerLength length = new BerLength();
codeLength += length.decode(is);
int totalLength = length.val;
codeLength += totalLength;
subCodeLength += berTag.decode(is);
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
subCodeLength += length.decode(is);
identification = new Identification();
subCodeLength += identification.decode(is, null);
subCodeLength += berTag.decode(is);
} else {
throw new IOException("Tag does not match the mandatory sequence element tag.");
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
dataValueDescriptor = new BerObjectDescriptor();
subCodeLength += dataValueDescriptor.decode(is, false);
subCodeLength += berTag.decode(is);
}
if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
dataValue = new BerOctetString();
subCodeLength += dataValue.decode(is, false);
if (subCodeLength == totalLength) {
return codeLength;
}
}
throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
}
Aggregations