public int encode(BerByteArrayOutputStream berOStream, boolean explicit) throws IOException { int codeLength; if (code != null) { codeLength = code.length; for (int i = code.length - 1; i >= 0; i--) { berOStream.write(code[i]); } } else { codeLength = 0; codeLength += mmsInitResponseDetail.encode(berOStream, false); codeLength += (new BerIdentifier(BerIdentifier.CONTEXT_CLASS, BerIdentifier.CONSTRUCTED, 4)) .encode(berOStream); if (negotiatedDataStructureNestingLevel != null) { codeLength += negotiatedDataStructureNestingLevel.encode(berOStream, false); codeLength += (new BerIdentifier(BerIdentifier.CONTEXT_CLASS, BerIdentifier.PRIMITIVE, 3)) .encode(berOStream); } codeLength += negotiatedMaxServOutstandingCalled.encode(berOStream, false); codeLength += (new BerIdentifier(BerIdentifier.CONTEXT_CLASS, BerIdentifier.PRIMITIVE, 2)) .encode(berOStream); codeLength += negotiatedMaxServOutstandingCalling.encode(berOStream, false); codeLength += (new BerIdentifier(BerIdentifier.CONTEXT_CLASS, BerIdentifier.PRIMITIVE, 1)) .encode(berOStream); if (localDetailCalled != null) { codeLength += localDetailCalled.encode(berOStream, false); codeLength += (new BerIdentifier(BerIdentifier.CONTEXT_CLASS, BerIdentifier.PRIMITIVE, 0)) .encode(berOStream); } codeLength += BerLength.encodeLength(berOStream, codeLength); } if (explicit) { codeLength += id.encode(berOStream); } return codeLength; }
public int encode(BerByteArrayOutputStream berOStream, boolean explicit) throws IOException { int codeLength; if (code != null) { codeLength = code.length; for (int i = code.length - 1; i >= 0; i--) { berOStream.write(code[i]); } } else { codeLength = 0; codeLength += confirmedServiceRequest.encode(berOStream, true); codeLength += invokeID.encode(berOStream, true); codeLength += BerLength.encodeLength(berOStream, codeLength); } if (explicit) { codeLength += id.encode(berOStream); } return codeLength; }