コード例 #1
0
  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;
  }
コード例 #2
0
 public void encodeAndSave(int encodingSizeGuess) throws IOException {
   BerByteArrayOutputStream berOStream = new BerByteArrayOutputStream(encodingSizeGuess);
   encode(berOStream, false);
   code = berOStream.getArray();
 }