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 voidput(String name, boolean value)Puts the value of the boolean field identified bynameto the persistent field.abstract voidput(String name, byte value)Puts the value of the byte field identified bynameto the persistent field.abstract voidput(String name, char value)Puts the value of the character field identified bynameto the persistent field.abstract voidput(String name, double value)Puts the value of the double field identified bynameto the persistent field.abstract voidput(String name, float value)Puts the value of the float field identified bynameto the persistent field.abstract voidput(String name, int value)Puts the value of the integer field identified bynameto the persistent field.abstract voidput(String name, long value)Puts the value of the long field identified bynameto the persistent field.abstract voidput(String name, short value)Puts the value of the short field identified bynameto the persistent field.abstract voidput(String name, Object value)Puts the value of the Object field identified bynameto the persistent field.abstract voidwrite(ObjectOutput out)Deprecated.This method is unsafe and may corrupt the target stream.
-
Constructor Details
-
PutField
public PutField()
-
-
Method Details
-
put
Puts the value of the boolean field identified bynameto the persistent field.- Parameters:
name- the name of the field to serialize.value- the value that is put to the persistent field.
-
put
Puts the value of the character field identified bynameto the persistent field.- Parameters:
name- the name of the field to serialize.value- the value that is put to the persistent field.
-
put
Puts the value of the byte field identified bynameto the persistent field.- Parameters:
name- the name of the field to serialize.value- the value that is put to the persistent field.
-
put
Puts the value of the short field identified bynameto the persistent field.- Parameters:
name- the name of the field to serialize.value- the value that is put to the persistent field.
-
put
Puts the value of the integer field identified bynameto the persistent field.- Parameters:
name- the name of the field to serialize.value- the value that is put to the persistent field.
-
put
Puts the value of the long field identified bynameto the persistent field.- Parameters:
name- the name of the field to serialize.value- the value that is put to the persistent field.
-
put
Puts the value of the float field identified bynameto the persistent field.- Parameters:
name- the name of the field to serialize.value- the value that is put to the persistent field.
-
put
Puts the value of the double field identified bynameto the persistent field.- Parameters:
name- the name of the field to serialize.value- the value that is put to the persistent field.
-
put
Puts the value of the Object field identified bynameto the persistent field.- Parameters:
name- the name of the field to serialize.value- the value that is put to the persistent field.
-
write
Deprecated.This method is unsafe and may corrupt the target stream. Use ObjectOutputStream#writeFields() instead.Writes the fields to the target streamout.- Parameters:
out- the target stream- Throws:
IOException- if an error occurs while writing to the target stream.
-