コード例 #1
0
ファイル: IOR.java プロジェクト: Blueash/gcc
  /**
   * Read the IOR from the provided input stream, not reading the endian data at the beginning of
   * the stream. The IOR is thansferred in this form in {@link write_Object(org.omg.CORBA.Object)}.
   *
   * <p>If the stream contains a null value, the Id and Internet fields become equal to null.
   * Otherwise Id contains some string (possibly empty).
   *
   * <p>Id is checked for null in AbstractCdrInput that then returns null instead of object.
   *
   * @param c a stream to read from.
   * @throws IOException if the stream throws it.
   */
  public void _read_no_endian(AbstractCdrInput c) throws IOException, BAD_PARAM {
    Id = c.read_string();

    int n_profiles = c.read_long();

    if (n_profiles == 0) {
      Id = null;
      Internet = null;
      return;
    }

    for (int i = 0; i < n_profiles; i++) {
      int tag = c.read_long();
      BufferredCdrInput profile = c.read_encapsulation();

      if (tag == Internet_profile.TAG_INTERNET_IOP) {
        Internet = new Internet_profile();
        Internet.version = Version.read_version(profile);
        Internet.host = profile.read_string();
        Internet.port = profile.gnu_read_ushort();

        key = profile.read_sequence();

        // Read tagged components.
        int n_components = 0;

        try {
          if (Internet.version.since_inclusive(1, 1)) n_components = profile.read_long();

          for (int t = 0; t < n_components; t++) {
            int ctag = profile.read_long();

            if (ctag == CodeSets_profile.TAG_CODE_SETS) {
              Internet.CodeSets.read(profile);
            } else {
              // Construct a generic component for codesets
              // profile.
              TaggedComponent pc = new TaggedComponent();
              pc.tag = ctag;
              pc.component_data = profile.read_sequence();
              Internet.components.add(pc);
            }
          }
        } catch (Unexpected ex) {
          ex.printStackTrace();
        }
      } else {
        // Construct a generic profile.
        TaggedProfile p = new TaggedProfile();
        p.tag = tag;
        p.profile_data = profile.buffer.getBuffer();

        profiles.add(p);
      }
    }
  }
コード例 #2
0
ファイル: IOR.java プロジェクト: Blueash/gcc
  /**
   * Read the IOR from the provided input stream.
   *
   * @param c a stream to read from.
   * @throws IOException if the stream throws it.
   */
  public void _read(AbstractCdrInput c) throws IOException, BAD_PARAM {
    int endian;

    endian = c.read_long();
    if (endian != 0) {
      Big_Endian = false;
      c.setBigEndian(false);
    }
    _read_no_endian(c);
  }