1. /*
  2. * @(#)TypeCodeImplHelper.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. * Licensed Materials - Property of IBM
  9. * RMI-IIOP v1.0
  10. * Copyright IBM Corp. 1998 1999 All Rights Reserved
  11. *
  12. * US Government Users Restricted Rights - Use, duplication or
  13. * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  14. */
  15. package com.sun.corba.se.internal.corba;
  16. abstract public class TypeCodeImplHelper
  17. {
  18. private static String _id = "IDL:omg.org/CORBA/TypeCode:1.0";
  19. public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.TypeCode that)
  20. {
  21. org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
  22. a.type (type ());
  23. write (out, that);
  24. a.read_value (out.create_input_stream (), type ());
  25. }
  26. public static org.omg.CORBA.TypeCode extract (org.omg.CORBA.Any a)
  27. {
  28. return read (a.create_input_stream ());
  29. }
  30. private static org.omg.CORBA.TypeCode __typeCode = null;
  31. synchronized public static org.omg.CORBA.TypeCode type ()
  32. {
  33. if (__typeCode == null)
  34. {
  35. __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode);
  36. }
  37. return __typeCode;
  38. }
  39. public static String id ()
  40. {
  41. return _id;
  42. }
  43. public static org.omg.CORBA.TypeCode read (org.omg.CORBA.portable.InputStream istream)
  44. {
  45. return istream.read_TypeCode ();
  46. }
  47. public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.TypeCode value)
  48. {
  49. ostream.write_TypeCode (value);
  50. }
  51. }