1. /*
  2. * @(#)FixedHolder.java 1.12 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. package org.omg.CORBA;
  8. import org.omg.CORBA.portable.Streamable;
  9. import org.omg.CORBA.portable.InputStream;
  10. import org.omg.CORBA.portable.OutputStream;
  11. /**
  12. * The Holder for <tt>Fixed</tt>. For more information on
  13. * Holder files, see <a href="doc-files/generatedfiles.html#holder">
  14. * "Generated Files: Holder Files"</a>.<P>
  15. * FixedHolder is a container class for values of IDL type "fixed",
  16. * which is mapped to the Java class java.math.BigDecimal.
  17. * It is usually used to store "out" and "inout" IDL method parameters.
  18. * If an IDL method signature has a fixed as an "out" or "inout" parameter,
  19. * the programmer must pass an instance of FixedHolder as the corresponding
  20. * parameter in the method invocation; for "inout" parameters, the programmer
  21. * must also fill the "in" value to be sent to the server.
  22. * Before the method invocation returns, the ORB will fill in the contained
  23. * value corresponding to the "out" value returned from the server.
  24. *
  25. * @version 1.14 09/09/97
  26. */
  27. public final class FixedHolder implements Streamable {
  28. /**
  29. * The value held by the FixedHolder
  30. */
  31. public java.math.BigDecimal value;
  32. /**
  33. * Construct the FixedHolder without initializing the contained value.
  34. */
  35. public FixedHolder() {
  36. }
  37. /**
  38. * Construct the FixedHolder and initialize it with the given value.
  39. * @param initial the value used to initialize the FixedHolder
  40. */
  41. public FixedHolder(java.math.BigDecimal initial) {
  42. value = initial;
  43. }
  44. /**
  45. * Read a fixed point value from the input stream and store it in
  46. * the value member.
  47. *
  48. * @param input the <code>InputStream</code> to read from.
  49. */
  50. public void _read(InputStream input) {
  51. value = input.read_fixed();
  52. }
  53. /**
  54. * Write the fixed point value stored in this holder to an
  55. * <code>OutputStream</code>.
  56. *
  57. * @param output the <code>OutputStream</code> to write into.
  58. */
  59. public void _write(OutputStream output) {
  60. output.write_fixed(value);
  61. }
  62. /**
  63. * Return the <code>TypeCode</code> of this holder object.
  64. *
  65. * @return the <code>TypeCode</code> object.
  66. */
  67. public org.omg.CORBA.TypeCode _type() {
  68. return ORB.init().get_primitive_tc(TCKind.tk_fixed);
  69. }
  70. }