# ObjectInputStream.GetField

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary: [Ctors](https://developer.android.com/reference/java/io/ObjectInputStream.GetField#pubctors) \| [Methods](https://developer.android.com/reference/java/io/ObjectInputStream.GetField#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/java/io/ObjectInputStream.GetField#inhmethods)  

# ObjectInputStream.GetField


`
public
static

abstract
class
ObjectInputStream.GetField
`


`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


`

`


`

|---|------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | java.io.ObjectInputStream.GetField |

<br />

*** ** * ** ***

Provide access to the persistent fields read from the input stream.

## Summary

|                                           ### Public constructors                                            ||
|-----------------------------------------------------------------------------------------------------------|---|
| ` `[GetField](https://developer.android.com/reference/java/io/ObjectInputStream.GetField#GetField())`() ` |

|                                                                                                                                                                                                                      ### Public methods                                                                                                                                                                                                                       ||
|----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract boolean`                                                                                | ` `[defaulted](https://developer.android.com/reference/java/io/ObjectInputStream.GetField#defaulted(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` name) ` Return true if the named field is defaulted and has no value in this stream.                                                                         |
| ` abstract boolean`                                                                                | ` `[get](https://developer.android.com/reference/java/io/ObjectInputStream.GetField#get(java.lang.String,%20boolean))`(`[String](https://developer.android.com/reference/java/lang/String)` name, boolean val) ` Get the value of the named boolean field from the persistent field.                                                                      |
| ` abstract byte`                                                                                   | ` `[get](https://developer.android.com/reference/java/io/ObjectInputStream.GetField#get(java.lang.String,%20byte))`(`[String](https://developer.android.com/reference/java/lang/String)` name, byte val) ` Get the value of the named byte field from the persistent field.                                                                               |
| ` abstract short`                                                                                  | ` `[get](https://developer.android.com/reference/java/io/ObjectInputStream.GetField#get(java.lang.String,%20short))`(`[String](https://developer.android.com/reference/java/lang/String)` name, short val) ` Get the value of the named short field from the persistent field.                                                                            |
| ` abstract char`                                                                                   | ` `[get](https://developer.android.com/reference/java/io/ObjectInputStream.GetField#get(java.lang.String,%20char))`(`[String](https://developer.android.com/reference/java/lang/String)` name, char val) ` Get the value of the named char field from the persistent field.                                                                               |
| ` abstract int`                                                                                    | ` `[get](https://developer.android.com/reference/java/io/ObjectInputStream.GetField#get(java.lang.String,%20int))`(`[String](https://developer.android.com/reference/java/lang/String)` name, int val) ` Get the value of the named int field from the persistent field.                                                                                  |
| ` abstract float`                                                                                  | ` `[get](https://developer.android.com/reference/java/io/ObjectInputStream.GetField#get(java.lang.String,%20float))`(`[String](https://developer.android.com/reference/java/lang/String)` name, float val) ` Get the value of the named float field from the persistent field.                                                                            |
| ` abstract double`                                                                                 | ` `[get](https://developer.android.com/reference/java/io/ObjectInputStream.GetField#get(java.lang.String,%20double))`(`[String](https://developer.android.com/reference/java/lang/String)` name, double val) ` Get the value of the named double field from the persistent field.                                                                         |
| ` abstract `[Object](https://developer.android.com/reference/java/lang/Object)                     | ` `[get](https://developer.android.com/reference/java/io/ObjectInputStream.GetField#get(java.lang.String,%20java.lang.Object))`(`[String](https://developer.android.com/reference/java/lang/String)` name, `[Object](https://developer.android.com/reference/java/lang/Object)` val) ` Get the value of the named Object field from the persistent field. |
| ` abstract long`                                                                                   | ` `[get](https://developer.android.com/reference/java/io/ObjectInputStream.GetField#get(java.lang.String,%20long))`(`[String](https://developer.android.com/reference/java/lang/String)` name, long val) ` Get the value of the named long field from the persistent field.                                                                               |
| ` abstract `[ObjectStreamClass](https://developer.android.com/reference/java/io/ObjectStreamClass) | ` `[getObjectStreamClass](https://developer.android.com/reference/java/io/ObjectInputStream.GetField#getObjectStreamClass())`() ` Get the ObjectStreamClass that describes the fields in the stream.                                                                                                                                                      |

| ### Inherited methods |
|-----------------------|---|
| From class ` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                        | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                             | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                            | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this `Object`.                                                                                                                                                 | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                   | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                              | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                           | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                              | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.                                                                                             | ||

## Public constructors

### GetField

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public GetField ()
```

<br />

<br />

## Public methods

### defaulted

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract boolean defaulted (String name)
```

Return true if the named field is defaulted and has no value in this
stream.

<br />

|                   Parameters                   ||
|--------|----------------------------------------|
| `name` | `String`: the name of the field <br /> |

|                               Returns                               ||
|-----------|----------------------------------------------------------|
| `boolean` | true, if and only if the named field is defaulted <br /> |

|                                                                                     Throws                                                                                      ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| [IOException](https://developer.android.com/reference/java/io/IOException)                             | if there are I/O errors while reading from the underlying `InputStream` |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if `name` does not correspond to a serializable field                   |

### get

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract boolean get (String name, 
                boolean val)
```

Get the value of the named boolean field from the persistent field.

<br />

|                                     Parameters                                     ||
|--------|----------------------------------------------------------------------------|
| `name` | `String`: the name of the field <br />                                     |
| `val`  | `boolean`: the default value to use if `name` does not have a value <br /> |

|                         Returns                          ||
|-----------|-----------------------------------------------|
| `boolean` | the value of the named `boolean` field <br /> |

|                                                                                     Throws                                                                                      ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| [IOException](https://developer.android.com/reference/java/io/IOException)                             | if there are I/O errors while reading from the underlying `InputStream` |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if type of `name` is not serializable or if the field type is incorrect |

### get

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract byte get (String name, 
                byte val)
```

Get the value of the named byte field from the persistent field.

<br />

|                                   Parameters                                    ||
|--------|-------------------------------------------------------------------------|
| `name` | `String`: the name of the field <br />                                  |
| `val`  | `byte`: the default value to use if `name` does not have a value <br /> |

|                      Returns                       ||
|--------|--------------------------------------------|
| `byte` | the value of the named `byte` field <br /> |

|                                                                                     Throws                                                                                      ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| [IOException](https://developer.android.com/reference/java/io/IOException)                             | if there are I/O errors while reading from the underlying `InputStream` |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if type of `name` is not serializable or if the field type is incorrect |

### get

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract short get (String name, 
                short val)
```

Get the value of the named short field from the persistent field.

<br />

|                                    Parameters                                    ||
|--------|--------------------------------------------------------------------------|
| `name` | `String`: the name of the field <br />                                   |
| `val`  | `short`: the default value to use if `name` does not have a value <br /> |

|                       Returns                        ||
|---------|---------------------------------------------|
| `short` | the value of the named `short` field <br /> |

|                                                                                     Throws                                                                                      ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| [IOException](https://developer.android.com/reference/java/io/IOException)                             | if there are I/O errors while reading from the underlying `InputStream` |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if type of `name` is not serializable or if the field type is incorrect |

### get

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract char get (String name, 
                char val)
```

Get the value of the named char field from the persistent field.

<br />

|                                   Parameters                                    ||
|--------|-------------------------------------------------------------------------|
| `name` | `String`: the name of the field <br />                                  |
| `val`  | `char`: the default value to use if `name` does not have a value <br /> |

|                      Returns                       ||
|--------|--------------------------------------------|
| `char` | the value of the named `char` field <br /> |

|                                                                                     Throws                                                                                      ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| [IOException](https://developer.android.com/reference/java/io/IOException)                             | if there are I/O errors while reading from the underlying `InputStream` |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if type of `name` is not serializable or if the field type is incorrect |

### get

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract int get (String name, 
                int val)
```

Get the value of the named int field from the persistent field.

<br />

|                                   Parameters                                   ||
|--------|------------------------------------------------------------------------|
| `name` | `String`: the name of the field <br />                                 |
| `val`  | `int`: the default value to use if `name` does not have a value <br /> |

|                     Returns                      ||
|-------|-------------------------------------------|
| `int` | the value of the named `int` field <br /> |

|                                                                                     Throws                                                                                      ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| [IOException](https://developer.android.com/reference/java/io/IOException)                             | if there are I/O errors while reading from the underlying `InputStream` |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if type of `name` is not serializable or if the field type is incorrect |

### get

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract float get (String name, 
                float val)
```

Get the value of the named float field from the persistent field.

<br />

|                                    Parameters                                    ||
|--------|--------------------------------------------------------------------------|
| `name` | `String`: the name of the field <br />                                   |
| `val`  | `float`: the default value to use if `name` does not have a value <br /> |

|                       Returns                        ||
|---------|---------------------------------------------|
| `float` | the value of the named `float` field <br /> |

|                                                                                     Throws                                                                                      ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| [IOException](https://developer.android.com/reference/java/io/IOException)                             | if there are I/O errors while reading from the underlying `InputStream` |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if type of `name` is not serializable or if the field type is incorrect |

### get

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract double get (String name, 
                double val)
```

Get the value of the named double field from the persistent field.

<br />

|                                    Parameters                                     ||
|--------|---------------------------------------------------------------------------|
| `name` | `String`: the name of the field <br />                                    |
| `val`  | `double`: the default value to use if `name` does not have a value <br /> |

|                        Returns                         ||
|----------|----------------------------------------------|
| `double` | the value of the named `double` field <br /> |

|                                                                                     Throws                                                                                      ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| [IOException](https://developer.android.com/reference/java/io/IOException)                             | if there are I/O errors while reading from the underlying `InputStream` |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if type of `name` is not serializable or if the field type is incorrect |

### get

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract Object get (String name, 
                Object val)
```

Get the value of the named Object field from the persistent field.

<br />

|                                    Parameters                                     ||
|--------|---------------------------------------------------------------------------|
| `name` | `String`: the name of the field <br />                                    |
| `val`  | `Object`: the default value to use if `name` does not have a value <br /> |

|                                                     Returns                                                      ||
|--------------------------------------------------------------------|----------------------------------------------|
| [Object](https://developer.android.com/reference/java/lang/Object) | the value of the named `Object` field <br /> |

|                                                                                     Throws                                                                                      ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| [IOException](https://developer.android.com/reference/java/io/IOException)                             | if there are I/O errors while reading from the underlying `InputStream` |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if type of `name` is not serializable or if the field type is incorrect |

### get

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract long get (String name, 
                long val)
```

Get the value of the named long field from the persistent field.

<br />

|                                   Parameters                                    ||
|--------|-------------------------------------------------------------------------|
| `name` | `String`: the name of the field <br />                                  |
| `val`  | `long`: the default value to use if `name` does not have a value <br /> |

|                      Returns                       ||
|--------|--------------------------------------------|
| `long` | the value of the named `long` field <br /> |

|                                                                                     Throws                                                                                      ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
| [IOException](https://developer.android.com/reference/java/io/IOException)                             | if there are I/O errors while reading from the underlying `InputStream` |
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if type of `name` is not serializable or if the field type is incorrect |

### getObjectStreamClass

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract ObjectStreamClass getObjectStreamClass ()
```

Get the ObjectStreamClass that describes the fields in the stream.

<br />

|                                                                          Returns                                                                           ||
|----------------------------------------------------------------------------------------|--------------------------------------------------------------------|
| [ObjectStreamClass](https://developer.android.com/reference/java/io/ObjectStreamClass) | the descriptor class that describes the serializable fields <br /> |