1. /*
  2. * @(#)ObjectHelper.java 1.6 00/02/02
  3. *
  4. * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. /*
  11. * Licensed Materials - Property of IBM
  12. * RMI-IIOP v1.0
  13. * Copyright IBM Corp. 1998 1999 All Rights Reserved
  14. *
  15. * US Government Users Restricted Rights - Use, duplication or
  16. * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17. */
  18. package org.omg.CORBA;
  19. abstract public class ObjectHelper
  20. {
  21. private static String _id = "";
  22. public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Object that)
  23. {
  24. org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
  25. a.type (type ());
  26. write (out, that);
  27. a.read_value (out.create_input_stream (), type ());
  28. }
  29. public static org.omg.CORBA.Object extract (org.omg.CORBA.Any a)
  30. {
  31. return read (a.create_input_stream ());
  32. }
  33. private static org.omg.CORBA.TypeCode __typeCode = null;
  34. synchronized public static org.omg.CORBA.TypeCode type ()
  35. {
  36. if (__typeCode == null)
  37. {
  38. __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (TCKind.tk_objref);
  39. }
  40. return __typeCode;
  41. }
  42. public static String id ()
  43. {
  44. return _id;
  45. }
  46. public static org.omg.CORBA.Object read (org.omg.CORBA.portable.InputStream istream)
  47. {
  48. return istream.read_Object ();
  49. }
  50. public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Object value)
  51. {
  52. ostream.write_Object (value);
  53. }
  54. }