1. /*
  2. * @(#)AnyImplHelper.java 1.10 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. /*
  8. * @(#)AnyImplHelper.java 1.10 03/01/23
  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 com.sun.corba.se.internal.corba;
  19. abstract public class AnyImplHelper
  20. {
  21. private static String _id = "IDL:omg.org/CORBA/Any:1.0";
  22. public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Any 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.Any 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 (org.omg.CORBA.TCKind.tk_any);
  39. }
  40. return __typeCode;
  41. }
  42. public static String id ()
  43. {
  44. return _id;
  45. }
  46. public static org.omg.CORBA.Any read (org.omg.CORBA.portable.InputStream istream)
  47. {
  48. return istream.read_any ();
  49. }
  50. public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Any value)
  51. {
  52. ostream.write_any (value);
  53. }
  54. }