コード例 #1
0
  public int decode(InputStream iStream) throws IOException {
    int codeLength = 0;

    myInteger = new AxdrInteger();
    codeLength += myInteger.decode(iStream);

    myInteger2 = new AxdrInteger();
    codeLength += myInteger2.decode(iStream);

    myBoolean = new AxdrBoolean();
    codeLength += myBoolean.decode(iStream);

    bitString = new AxdrBitString();
    codeLength += bitString.decode(iStream);

    enumerated = new AxdrEnum();
    codeLength += enumerated.decode(iStream);

    generalizedTime = new AxdrGeneralizedTime();
    codeLength += generalizedTime.decode(iStream);

    myNull = new AxdrNull();
    codeLength += myNull.decode(iStream);

    octetString = new AxdrOctetString();
    codeLength += octetString.decode(iStream);

    visibleString = new AxdrVisibleString();
    codeLength += visibleString.decode(iStream);

    my_sequence = new SubSeqOf_my_sequence();
    codeLength += my_sequence.decode(iStream);

    my_choice = new My_Choice();
    codeLength += my_choice.decode(iStream);

    return codeLength;
  }
コード例 #2
0
  public int encode(BerByteArrayOutputStream axdrOStream) throws IOException {

    int codeLength;

    if (code != null) {
      codeLength = code.length;
      for (int i = code.length - 1; i >= 0; i--) {
        axdrOStream.write(code[i]);
      }
    } else {
      codeLength = 0;
      codeLength += my_choice.encode(axdrOStream);

      codeLength += my_sequence.encode(axdrOStream);

      codeLength += visibleString.encode(axdrOStream);

      codeLength += octetString.encode(axdrOStream);

      codeLength += myNull.encode(axdrOStream);

      codeLength += generalizedTime.encode(axdrOStream);

      codeLength += enumerated.encode(axdrOStream);

      codeLength += bitString.encode(axdrOStream);

      codeLength += myBoolean.encode(axdrOStream);

      codeLength += myInteger2.encode(axdrOStream);

      codeLength += myInteger.encode(axdrOStream);
    }

    return codeLength;
  }