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