1. /*
  2. * @(#)StringValueHelper.java 1.14 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. * 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 org.omg.CORBA;
  16. /**
  17. * The Helper for <tt>StringValue</tt>. For more information on
  18. * Helper files, see <a href="doc-files/generatedfiles.html#helper">
  19. * "Generated Files: Helper Files"</a>.<P>
  20. * org/omg/CORBA/StringValueHelper.java
  21. * Generated by the IDL-to-Java compiler (portable), version "3.0"
  22. * from orb.idl
  23. * 31 May 1999 22:27:30 o'clock GMT+00:00
  24. *
  25. * The class definition has been modified to conform to the following
  26. * OMG specifications :
  27. * <ul>
  28. * <li> ORB core as defined by CORBA 2.3.1
  29. * (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
  30. * </li>
  31. *
  32. * <li> IDL/Java Language Mapping as defined in
  33. * <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
  34. * </li>
  35. * </ul>
  36. */
  37. public class StringValueHelper implements org.omg.CORBA.portable.BoxedValueHelper
  38. {
  39. private static String _id = "IDL:omg.org/CORBA/StringValue:1.0";
  40. private static StringValueHelper _instance = new StringValueHelper ();
  41. public static void insert (org.omg.CORBA.Any a, String that)
  42. {
  43. org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
  44. a.type (type ());
  45. write (out, that);
  46. a.read_value (out.create_input_stream (), type ());
  47. }
  48. public static String extract (org.omg.CORBA.Any a)
  49. {
  50. return read (a.create_input_stream ());
  51. }
  52. private static org.omg.CORBA.TypeCode __typeCode = null;
  53. private static boolean __active = false;
  54. synchronized public static org.omg.CORBA.TypeCode type ()
  55. {
  56. if (__typeCode == null)
  57. {
  58. synchronized (org.omg.CORBA.TypeCode.class)
  59. {
  60. if (__typeCode == null)
  61. {
  62. if (__active)
  63. {
  64. return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
  65. }
  66. __active = true;
  67. __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0);
  68. __typeCode = org.omg.CORBA.ORB.init ().create_value_box_tc (_id, "StringValue", __typeCode);
  69. __active = false;
  70. }
  71. }
  72. }
  73. return __typeCode;
  74. }
  75. public static String id ()
  76. {
  77. return _id;
  78. }
  79. public static String read (org.omg.CORBA.portable.InputStream istream)
  80. {
  81. if (!(istream instanceof org.omg.CORBA_2_3.portable.InputStream)) {
  82. throw new org.omg.CORBA.BAD_PARAM(); }
  83. return (String) ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (_instance);
  84. }
  85. public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)
  86. {
  87. String tmp;
  88. tmp = istream.read_string ();
  89. return (java.io.Serializable) tmp;
  90. }
  91. public static void write (org.omg.CORBA.portable.OutputStream ostream, String value)
  92. {
  93. if (!(ostream instanceof org.omg.CORBA_2_3.portable.OutputStream)) {
  94. throw new org.omg.CORBA.BAD_PARAM(); }
  95. ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, _instance);
  96. }
  97. public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable value)
  98. {
  99. if (!(value instanceof String)) {
  100. throw new org.omg.CORBA.MARSHAL(); }
  101. String valueType = (String) value;
  102. ostream.write_string (valueType);
  103. }
  104. public String get_id ()
  105. {
  106. return _id;
  107. }
  108. }