1. /*
  2. * @(#)WStringValueHelper.java 1.7 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. /* @(#)WStringValueHelper.java 1.7 00/02/02 */
  11. /*
  12. * Licensed Materials - Property of IBM
  13. * RMI-IIOP v1.0
  14. * Copyright IBM Corp. 1998 1999 All Rights Reserved
  15. *
  16. * US Government Users Restricted Rights - Use, duplication or
  17. * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  18. */
  19. package org.omg.CORBA;
  20. /**
  21. * org/omg/CORBA/WStringValueHelper.java
  22. * Generated by the IDL-to-Java compiler (portable), version "3.0"
  23. * from orb.idl
  24. * 31 May 1999 22:27:30 o'clock GMT+00:00
  25. */
  26. public final class WStringValueHelper implements org.omg.CORBA.portable.BoxedValueHelper
  27. {
  28. private static String _id = "IDL:omg.org/CORBA/WStringValue:1.0";
  29. private static WStringValueHelper _instance = new WStringValueHelper ();
  30. public WStringValueHelper()
  31. {
  32. }
  33. public static void insert (org.omg.CORBA.Any a, String that)
  34. {
  35. org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
  36. a.type (type ());
  37. write (out, that);
  38. a.read_value (out.create_input_stream (), type ());
  39. }
  40. public static String extract (org.omg.CORBA.Any a)
  41. {
  42. return read (a.create_input_stream ());
  43. }
  44. private static org.omg.CORBA.TypeCode __typeCode = null;
  45. private static boolean __active = false;
  46. synchronized public static org.omg.CORBA.TypeCode type ()
  47. {
  48. if (__typeCode == null)
  49. {
  50. synchronized (org.omg.CORBA.TypeCode.class)
  51. {
  52. if (__typeCode == null)
  53. {
  54. if (__active)
  55. {
  56. return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
  57. }
  58. __active = true;
  59. __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0);
  60. __typeCode = org.omg.CORBA.ORB.init ().create_value_box_tc (_id, "WStringValue", __typeCode);
  61. __active = false;
  62. }
  63. }
  64. }
  65. return __typeCode;
  66. }
  67. public static String id ()
  68. {
  69. return _id;
  70. }
  71. public static String read (org.omg.CORBA.portable.InputStream istream)
  72. {
  73. if (!(istream instanceof org.omg.CORBA_2_3.portable.InputStream)) {
  74. throw new org.omg.CORBA.BAD_PARAM(); }
  75. return (String) ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (_instance);
  76. }
  77. public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)
  78. {
  79. String tmp;
  80. tmp = istream.read_wstring ();
  81. return (java.io.Serializable) tmp;
  82. }
  83. public static void write (org.omg.CORBA.portable.OutputStream ostream, String value)
  84. {
  85. if (!(ostream instanceof org.omg.CORBA_2_3.portable.OutputStream)) {
  86. throw new org.omg.CORBA.BAD_PARAM(); }
  87. ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, _instance);
  88. }
  89. public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable value)
  90. {
  91. if (!(value instanceof String)) {
  92. throw new org.omg.CORBA.MARSHAL(); }
  93. String valueType = (String) value;
  94. ostream.write_wstring (valueType);
  95. }
  96. public String get_id ()
  97. {
  98. return _id;
  99. }
  100. }