Package java.io

Class ObjectOutputStream.PutField

java.lang.Object
java.io.ObjectOutputStream.PutField
Enclosing class:
ObjectOutputStream

public abstract static class ObjectOutputStream.PutField
extends Object
PutField is an inner class to provide access to the persistent fields that are written to the target stream.
  • Constructor Summary

    Constructors
    Constructor Description
    PutField()  
  • Method Summary

    Modifier and Type Method Description
    abstract void put​(String name, boolean value)
    Puts the value of the boolean field identified by name to the persistent field.
    abstract void put​(String name, byte value)
    Puts the value of the byte field identified by name to the persistent field.
    abstract void put​(String name, char value)
    Puts the value of the character field identified by name to the persistent field.
    abstract void put​(String name, double value)
    Puts the value of the double field identified by name to the persistent field.
    abstract void put​(String name, float value)
    Puts the value of the float field identified by name to the persistent field.
    abstract void put​(String name, int value)
    Puts the value of the integer field identified by name to the persistent field.
    abstract void put​(String name, long value)
    Puts the value of the long field identified by name to the persistent field.
    abstract void put​(String name, short value)
    Puts the value of the short field identified by name to the persistent field.
    abstract void put​(String name, Object value)
    Puts the value of the Object field identified by name to the persistent field.
    abstract void write​(ObjectOutput out)
    Deprecated.
    This method is unsafe and may corrupt the target stream.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PutField

      public PutField()
  • Method Details

    • put

      public abstract void put​(String name, boolean value)
      Puts the value of the boolean field identified by name to the persistent field.
      Parameters:
      name - the name of the field to serialize.
      value - the value that is put to the persistent field.
    • put

      public abstract void put​(String name, char value)
      Puts the value of the character field identified by name to the persistent field.
      Parameters:
      name - the name of the field to serialize.
      value - the value that is put to the persistent field.
    • put

      public abstract void put​(String name, byte value)
      Puts the value of the byte field identified by name to the persistent field.
      Parameters:
      name - the name of the field to serialize.
      value - the value that is put to the persistent field.
    • put

      public abstract void put​(String name, short value)
      Puts the value of the short field identified by name to the persistent field.
      Parameters:
      name - the name of the field to serialize.
      value - the value that is put to the persistent field.
    • put

      public abstract void put​(String name, int value)
      Puts the value of the integer field identified by name to the persistent field.
      Parameters:
      name - the name of the field to serialize.
      value - the value that is put to the persistent field.
    • put

      public abstract void put​(String name, long value)
      Puts the value of the long field identified by name to the persistent field.
      Parameters:
      name - the name of the field to serialize.
      value - the value that is put to the persistent field.
    • put

      public abstract void put​(String name, float value)
      Puts the value of the float field identified by name to the persistent field.
      Parameters:
      name - the name of the field to serialize.
      value - the value that is put to the persistent field.
    • put

      public abstract void put​(String name, double value)
      Puts the value of the double field identified by name to the persistent field.
      Parameters:
      name - the name of the field to serialize.
      value - the value that is put to the persistent field.
    • put

      public abstract void put​(String name, Object value)
      Puts the value of the Object field identified by name to the persistent field.
      Parameters:
      name - the name of the field to serialize.
      value - the value that is put to the persistent field.
    • write

      @Deprecated public abstract void write​(ObjectOutput out) throws IOException
      Deprecated.
      This method is unsafe and may corrupt the target stream. Use ObjectOutputStream#writeFields() instead.
      Writes the fields to the target stream out.
      Parameters:
      out - the target stream
      Throws:
      IOException - if an error occurs while writing to the target stream.