read_instance(input, ox, value_tag);
read_instance(input, ox, value_tag, null);
  public static Serializable read(InputStream input)  {    // Explicitly prevent the stream from closing as we may need    // to read the subsequent bytes as well. Stream may be auto-closed    // in its finalizer.    try      {        // We may need to jump back if the value is read via value factory.        input.mark(512);        int value_tag = input.read_long();        checkTag(value_tag);        String codebase = null;        String[] ids = null;        String id = null;        // The existing implementing object.        java.lang.Object ox = null;        // Check for the agreed null value.        if (value_tag == vt_NULL)          return null;        else if (value_tag == vt_INDIRECTION)          // TODO FIXME Implement support for indirections.          throw new NO_IMPLEMENT("Indirections unsupported");        else          {            // Read the value.            if ((value_tag & vf_CODEBASE) != 0)              {                // The codebase is present. The codebase is a space                // separated list of URLs from where the implementing                // code can be downloaded.                codebase = input.read_string();              }            if ((value_tag & vf_MULTIPLE_IDS) != 0)              {                // Multiple supported repository ids are present.                ids = StringSeqHelper.read(input);                for (int i = 0; (i < ids.length) && (ox == null); i++)                  {                    ox = ObjectCreator.Idl2Object(ids [ i ]);                    if (ox == null)                      {                        // Try to find the value factory.                        ValueFactory f =                          ((org.omg.CORBA_2_3.ORB) input.orb()).lookup_value_factory(ids [ i ]);                        if (f != null)                          {                            // Reset, as the value factory reads from beginning.                            input.reset();                            return f.read_value((org.omg.CORBA_2_3.portable.InputStream) input);                          }                      }                  }              }            else if ((value_tag & vf_ID) != 0)              {                // Single supported repository id is present.                id = input.read_string();                ox = ObjectCreator.Idl2Object(id);                if (ox == null)                  {                    // Try to find the value factory.                    ValueFactory f =                      ((org.omg.CORBA_2_3.ORB) input.orb()).lookup_value_factory(id);                    if (f != null)                      {                        input.reset();                        return f.read_value((org.omg.CORBA_2_3.portable.InputStream) input);                      }                  }              }          }        if (ox == null)          throw new MARSHAL("Unable to instantiate the value type");        else          {            read_instance(input, ox, value_tag);            return (Serializable) ox;          }      }    catch (Exception ex)      {        throw new MARSHAL(ex + ":" + ex.getMessage());      }  }