Skip to content

Most visited

Recently visited

navigation
Added in API level 1

ObjectInputStream.GetField

public static abstract class ObjectInputStream.GetField
extends Object

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


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 byte get(String name, byte defaultValue)

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

abstract long get(String name, long defaultValue)

Gets the value of the long 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 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 float get(String name, float defaultValue)

Gets the value of the float 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 boolean get(String name, boolean defaultValue)

Gets the value of the boolean 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 ObjectStreamClass getObjectStreamClass()

Gets the ObjectStreamClass that describes a field.

Inherited methods

From class java.lang.Object

Public constructors

ObjectInputStream.GetField

Added in API level 1
ObjectInputStream.GetField ()

Public methods

defaulted

Added in API level 1
boolean defaulted (String name)

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

Parameters
name String: the name of the field to check.
Returns
boolean 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.

get

Added in API level 1
byte get (String name, 
                byte defaultValue)

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

Parameters
name String: the name of the field to get.
defaultValue byte: the default value that is used if the field does not have a value when read from the source stream.
Returns
byte 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.

get

Added in API level 1
long get (String name, 
                long defaultValue)

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

Parameters
name String: the name of the field to get.
defaultValue long: the default value that is used if the field does not have a value when read from the source stream.
Returns
long 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.

get

Added in API level 1
Object get (String name, 
                Object defaultValue)

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

Parameters
name String: the name of the field to get.
defaultValue Object: the default value that is used if the field does not have a value when read from the source stream.
Returns
Object 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.

get

Added in API level 1
int get (String name, 
                int defaultValue)

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

Parameters
name String: the name of the field to get.
defaultValue int: the default value that is used if the field does not have a value when read from the source stream.
Returns
int 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.

get

Added in API level 1
short get (String name, 
                short defaultValue)

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

Parameters
name String: the name of the field to get.
defaultValue short: the default value that is used if the field does not have a value when read from the source stream.
Returns
short 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.

get

Added in API level 1
float get (String name, 
                float defaultValue)

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

Parameters
name String: the name of the field to get.
defaultValue float: the default value that is used if the field does not have a value when read from the source stream.
Returns
float 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.

get

Added in API level 1
double get (String name, 
                double defaultValue)

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

Parameters
name String: the name of the field to get.
defaultValue double: the default value that is used if the field does not have a value when read from the source stream.
Returns
double 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.

get

Added in API level 1
boolean get (String name, 
                boolean defaultValue)

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

Parameters
name String: the name of the field to get.
defaultValue boolean: the default value that is used if the field does not have a value when read from the source stream.
Returns
boolean 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.

get

Added in API level 1
char get (String name, 
                char defaultValue)

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

Parameters
name String: the name of the field to get.
defaultValue char: the default value that is used if the field does not have a value when read from the source stream.
Returns
char 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.

getObjectStreamClass

Added in API level 1
ObjectStreamClass getObjectStreamClass ()

Gets the ObjectStreamClass that describes a field.

Returns
ObjectStreamClass the descriptor class for a serialized field.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.