public static abstract class

ObjectInputStream.GetField

extends Object
java.lang.Object
   ↳ java.io.ObjectInputStream.GetField

Class Overview

GetField is an inner class that provides access to the persistent fields read from the source stream.

Summary

Public Constructors
ObjectInputStream.GetField()
Public Methods
abstract boolean defaulted(String name)
Indicates if the field identified by name is defaulted.
abstract long get(String name, long defaultValue)
Gets the value of the long field identified by name from the persistent field.
abstract double get(String name, double defaultValue)
Gets the value of the double field identified by name from the persistent field.
abstract float get(String name, float defaultValue)
Gets the value of the float field identified by name from the persistent field.
abstract byte get(String name, byte defaultValue)
Gets the value of the byte field identified by name from the persistent field.
abstract char get(String name, char defaultValue)
Gets the value of the character field identified by name from the persistent field.
abstract int get(String name, int defaultValue)
Gets the value of the integer field identified by name from the persistent field.
abstract short get(String name, short defaultValue)
Gets the value of the short field identified by name from the persistent field.
abstract boolean get(String name, boolean defaultValue)
Gets the value of the boolean field identified by name from the persistent field.
abstract Object get(String name, Object defaultValue)
Gets the value of the object field identified by name from the persistent field.
abstract ObjectStreamClass getObjectStreamClass()
Gets the ObjectStreamClass that describes a field.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ObjectInputStream.GetField ()

Since: API Level 1

Public Methods

public abstract boolean defaulted (String name)

Since: API Level 1

Indicates if the field identified by name is defaulted. This means that it has no value in this stream.

Parameters
name the name of the field to check.
Returns
  • true if the field is defaulted, false otherwise.
Throws
IllegalArgumentException if name does not identify a serializable field.
IOException if an error occurs while reading from the source input stream.

public abstract long get (String name, long defaultValue)

Since: API Level 1

Gets the value of the long field identified by name from the persistent field.

Parameters
name the name of the field to get.
defaultValue the default value that is used if the field does not have a value when read from the source stream.
Returns
  • the value of the field identified by name.
Throws
IOException if an error occurs while reading from the source input stream.
IllegalArgumentException if the type of the field identified by name is not long.

public abstract double get (String name, double defaultValue)

Since: API Level 1

Gets the value of the double field identified by name from the persistent field.

Parameters
name the name of the field to get.
defaultValue the default value that is used if the field does not have a value when read from the source stream.
Returns
  • the value of the field identified by name.
Throws
IOException if an error occurs while reading from the source input stream.
IllegalArgumentException if the type of the field identified by name is not double.

public abstract float get (String name, float defaultValue)

Since: API Level 1

Gets the value of the float field identified by name from the persistent field.

Parameters
name the name of the field to get.
defaultValue the default value that is used if the field does not have a value when read from the source stream.
Returns
  • the value of the field identified by name.
Throws
IOException if an error occurs while reading from the source input stream.
IllegalArgumentException if the type of the field identified by float is not char.

public abstract byte get (String name, byte defaultValue)

Since: API Level 1

Gets the value of the byte field identified by name from the persistent field.

Parameters
name the name of the field to get.
defaultValue the default value that is used if the field does not have a value when read from the source stream.
Returns
  • the value of the field identified by name.
Throws
IOException if an error occurs while reading from the source input stream.
IllegalArgumentException if the type of the field identified by name is not byte.

public abstract char get (String name, char defaultValue)

Since: API Level 1

Gets the value of the character field identified by name from the persistent field.

Parameters
name the name of the field to get.
defaultValue the default value that is used if the field does not have a value when read from the source stream.
Returns
  • the value of the field identified by name.
Throws
IOException if an error occurs while reading from the source input stream.
IllegalArgumentException if the type of the field identified by name is not char.

public abstract int get (String name, int defaultValue)

Since: API Level 1

Gets the value of the integer field identified by name from the persistent field.

Parameters
name the name of the field to get.
defaultValue the default value that is used if the field does not have a value when read from the source stream.
Returns
  • the value of the field identified by name.
Throws
IOException if an error occurs while reading from the source input stream.
IllegalArgumentException if the type of the field identified by name is not int.

public abstract short get (String name, short defaultValue)

Since: API Level 1

Gets the value of the short field identified by name from the persistent field.

Parameters
name the name of the field to get.
defaultValue the default value that is used if the field does not have a value when read from the source stream.
Returns
  • the value of the field identified by name.
Throws
IOException if an error occurs while reading from the source input stream.
IllegalArgumentException if the type of the field identified by name is not short.

public abstract boolean get (String name, boolean defaultValue)

Since: API Level 1

Gets the value of the boolean field identified by name from the persistent field.

Parameters
name the name of the field to get.
defaultValue the default value that is used if the field does not have a value when read from the source stream.
Returns
  • the value of the field identified by name.
Throws
IOException if an error occurs while reading from the source input stream.
IllegalArgumentException if the type of the field identified by name is not boolean.

public abstract Object get (String name, Object defaultValue)

Since: API Level 1

Gets the value of the object field identified by name from the persistent field.

Parameters
name the name of the field to get.
defaultValue the default value that is used if the field does not have a value when read from the source stream.
Returns
  • the value of the field identified by name.
Throws
IOException if an error occurs while reading from the source input stream.
IllegalArgumentException if the type of the field identified by name is not Object.

public abstract ObjectStreamClass getObjectStreamClass ()

Since: API Level 1

Gets the ObjectStreamClass that describes a field.

Returns
  • the descriptor class for a serialized field.