java.io
Class ObjectOutputStream.PutFieldImpl

java.lang.Object
  extended byjava.io.ObjectOutputStream.PutField
      extended byjava.io.ObjectOutputStream.PutFieldImpl
Enclosing class:
ObjectOutputStream

private class ObjectOutputStream.PutFieldImpl
extends ObjectOutputStream.PutField

Default PutField implementation.


Field Summary
private  ObjectStreamClass desc
          class descriptor describing serializable fields
private  Object[] objVals
          object field values
private  byte[] primVals
          primitive field values
 
Constructor Summary
(package private) ObjectOutputStream.PutFieldImpl(ObjectStreamClass desc)
          Creates PutFieldImpl object for writing fields defined in given class descriptor.
 
Method Summary
private  int getFieldOffset(String name, Class type)
          Returns offset of field with given name and type.
 void put(String name, boolean val)
          Put the value of the named boolean field into the persistent field.
 void put(String name, byte val)
          Put the value of the named byte field into the persistent field.
 void put(String name, char val)
          Put the value of the named char field into the persistent field.
 void put(String name, double val)
          Put the value of the named double field into the persistent field.
 void put(String name, float val)
          Put the value of the named float field into the persistent field.
 void put(String name, int val)
          Put the value of the named int field into the persistent field.
 void put(String name, long val)
          Put the value of the named long field into the persistent field.
 void put(String name, Object val)
          Put the value of the named Object field into the persistent field.
 void put(String name, short val)
          Put the value of the named short field into the persistent field.
 void write(ObjectOutput out)
          Write the data and fields to the specified ObjectOutput stream.
(package private)  void writeFields()
          Writes buffered primitive data and object fields to stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

desc

private final ObjectStreamClass desc
class descriptor describing serializable fields


primVals

private final byte[] primVals
primitive field values


objVals

private final Object[] objVals
object field values

Constructor Detail

ObjectOutputStream.PutFieldImpl

ObjectOutputStream.PutFieldImpl(ObjectStreamClass desc)
Creates PutFieldImpl object for writing fields defined in given class descriptor.

Method Detail

put

public void put(String name,
                boolean val)
Description copied from class: ObjectOutputStream.PutField
Put the value of the named boolean field into the persistent field.

Specified by:
put in class ObjectOutputStream.PutField
Parameters:
name - the name of the serializable field
val - the value to assign to the field

put

public void put(String name,
                byte val)
Description copied from class: ObjectOutputStream.PutField
Put the value of the named byte field into the persistent field.

Specified by:
put in class ObjectOutputStream.PutField
Parameters:
name - the name of the serializable field
val - the value to assign to the field

put

public void put(String name,
                char val)
Description copied from class: ObjectOutputStream.PutField
Put the value of the named char field into the persistent field.

Specified by:
put in class ObjectOutputStream.PutField
Parameters:
name - the name of the serializable field
val - the value to assign to the field

put

public void put(String name,
                short val)
Description copied from class: ObjectOutputStream.PutField
Put the value of the named short field into the persistent field.

Specified by:
put in class ObjectOutputStream.PutField
Parameters:
name - the name of the serializable field
val - the value to assign to the field

put

public void put(String name,
                int val)
Description copied from class: ObjectOutputStream.PutField
Put the value of the named int field into the persistent field.

Specified by:
put in class ObjectOutputStream.PutField
Parameters:
name - the name of the serializable field
val - the value to assign to the field

put

public void put(String name,
                float val)
Description copied from class: ObjectOutputStream.PutField
Put the value of the named float field into the persistent field.

Specified by:
put in class ObjectOutputStream.PutField
Parameters:
name - the name of the serializable field
val - the value to assign to the field

put

public void put(String name,
                long val)
Description copied from class: ObjectOutputStream.PutField
Put the value of the named long field into the persistent field.

Specified by:
put in class ObjectOutputStream.PutField
Parameters:
name - the name of the serializable field
val - the value to assign to the field

put

public void put(String name,
                double val)
Description copied from class: ObjectOutputStream.PutField
Put the value of the named double field into the persistent field.

Specified by:
put in class ObjectOutputStream.PutField
Parameters:
name - the name of the serializable field
val - the value to assign to the field

put

public void put(String name,
                Object val)
Description copied from class: ObjectOutputStream.PutField
Put the value of the named Object field into the persistent field.

Specified by:
put in class ObjectOutputStream.PutField
Parameters:
name - the name of the serializable field
val - the value to assign to the field

write

public void write(ObjectOutput out)
           throws IOException
Description copied from class: ObjectOutputStream.PutField
Write the data and fields to the specified ObjectOutput stream.

Specified by:
write in class ObjectOutputStream.PutField
Parameters:
out - the stream to write the data and fields to
Throws:
IOException - if I/O errors occur while writing to the underlying stream

writeFields

void writeFields()
           throws IOException
Writes buffered primitive data and object fields to stream.

Throws:
IOException

getFieldOffset

private int getFieldOffset(String name,
                           Class type)
Returns offset of field with given name and type. A specified type of null matches all types, Object.class matches all non-primitive types, and any other non-null type matches assignable types only. Throws IllegalArgumentException if no matching field found.