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