1. /*
  2. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  3. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  4. */
  5. /*
  6. * @(#)LegacyHookPutFields.java 1.3 03/01/23
  7. */
  8. package com.sun.corba.se.internal.orbutil;
  9. import java.io.*;
  10. import java.util.Hashtable;
  11. /**
  12. * Since ObjectOutputStream.PutField methods specify no exceptions,
  13. * we are not checking for null parameters on put methods.
  14. */
  15. class LegacyHookPutFields extends ObjectOutputStream.PutField
  16. {
  17. private Hashtable fields = new Hashtable();
  18. /**
  19. * Put the value of the named boolean field into the persistent field.
  20. */
  21. public void put(String name, boolean value){
  22. fields.put(name, new Boolean(value));
  23. }
  24. /**
  25. * Put the value of the named char field into the persistent fields.
  26. */
  27. public void put(String name, char value){
  28. fields.put(name, new Character(value));
  29. }
  30. /**
  31. * Put the value of the named byte field into the persistent fields.
  32. */
  33. public void put(String name, byte value){
  34. fields.put(name, new Byte(value));
  35. }
  36. /**
  37. * Put the value of the named short field into the persistent fields.
  38. */
  39. public void put(String name, short value){
  40. fields.put(name, new Short(value));
  41. }
  42. /**
  43. * Put the value of the named int field into the persistent fields.
  44. */
  45. public void put(String name, int value){
  46. fields.put(name, new Integer(value));
  47. }
  48. /**
  49. * Put the value of the named long field into the persistent fields.
  50. */
  51. public void put(String name, long value){
  52. fields.put(name, new Long(value));
  53. }
  54. /**
  55. * Put the value of the named float field into the persistent fields.
  56. *
  57. */
  58. public void put(String name, float value){
  59. fields.put(name, new Float(value));
  60. }
  61. /**
  62. * Put the value of the named double field into the persistent field.
  63. */
  64. public void put(String name, double value){
  65. fields.put(name, new Double(value));
  66. }
  67. /**
  68. * Put the value of the named Object field into the persistent field.
  69. */
  70. public void put(String name, Object value){
  71. fields.put(name, value);
  72. }
  73. /**
  74. * Write the data and fields to the specified ObjectOutput stream.
  75. */
  76. public void write(ObjectOutput out) throws IOException {
  77. out.writeObject(fields);
  78. }
  79. }