1. /*
  2. * @(#)StringValueHelper.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. /*
  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 org.omg.CORBA;
  19. /**
  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. public final class StringValueHelper implements org.omg.CORBA.portable.BoxedValueHelper
  26. {
  27. private static String _id = "IDL:omg.org/CORBA/StringValue:1.0";
  28. private static StringValueHelper _instance = new StringValueHelper ();
  29. public StringValueHelper()
  30. {
  31. }
  32. public static void insert (org.omg.CORBA.Any a, String that)
  33. {
  34. org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
  35. a.type (type ());
  36. write (out, that);
  37. a.read_value (out.create_input_stream (), type ());
  38. }
  39. public static String extract (org.omg.CORBA.Any a)
  40. {
  41. return read (a.create_input_stream ());
  42. }
  43. private static org.omg.CORBA.TypeCode __typeCode = null;
  44. private static boolean __active = false;
  45. synchronized public static org.omg.CORBA.TypeCode type ()
  46. {
  47. if (__typeCode == null)
  48. {
  49. synchronized (org.omg.CORBA.TypeCode.class)
  50. {
  51. if (__typeCode == null)
  52. {
  53. if (__active)
  54. {
  55. return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
  56. }
  57. __active = true;
  58. __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0);
  59. __typeCode = org.omg.CORBA.ORB.init ().create_value_box_tc (_id, "StringValue", __typeCode);
  60. __active = false;
  61. }
  62. }
  63. }
  64. return __typeCode;
  65. }
  66. public static String id ()
  67. {
  68. return _id;
  69. }
  70. public static String read (org.omg.CORBA.portable.InputStream istream)
  71. {
  72. if (!(istream instanceof org.omg.CORBA_2_3.portable.InputStream)) {
  73. throw new org.omg.CORBA.BAD_PARAM(); }
  74. return (String) ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (_instance);
  75. }
  76. public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)
  77. {
  78. String tmp;
  79. tmp = istream.read_string ();
  80. return (java.io.Serializable) tmp;
  81. }
  82. public static void write (org.omg.CORBA.portable.OutputStream ostream, String value)
  83. {
  84. if (!(ostream instanceof org.omg.CORBA_2_3.portable.OutputStream)) {
  85. throw new org.omg.CORBA.BAD_PARAM(); }
  86. ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, _instance);
  87. }
  88. public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable value)
  89. {
  90. if (!(value instanceof String)) {
  91. throw new org.omg.CORBA.MARSHAL(); }
  92. String valueType = (String) value;
  93. ostream.write_string (valueType);
  94. }
  95. public String get_id ()
  96. {
  97. return _id;
  98. }
  99. }