# ObjectInputStream.GetField

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

# GetField

```
abstract class GetField
```

|---|--------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                           ||
| ↳ | [java.io.ObjectInputStream.GetField](https://developer.android.com/reference/kotlin/java/io/ObjectInputStream.GetField#) |

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

## Summary

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

|                                                                                                                                                                                                                                            Public methods                                                                                                                                                                                                                                             ||
|--------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| abstract[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)             | [defaulted](https://developer.android.com/reference/kotlin/java/io/ObjectInputStream.GetField#defaulted(kotlin.String))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Return true if the named field is defaulted and has no value in this stream.                                                                                           |
| abstract[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)             | [get](https://developer.android.com/reference/kotlin/java/io/ObjectInputStream.GetField#get(kotlin.String,%20kotlin.Boolean))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `val:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Get the value of the named boolean field from the persistent field. |
| abstract[Byte](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte/index.html)                   | [get](https://developer.android.com/reference/kotlin/java/io/ObjectInputStream.GetField#get(kotlin.String,%20kotlin.Byte))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `val:` `[Byte](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte/index.html)`)` Get the value of the named byte field from the persistent field.             |
| abstract[Char](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char/index.html)                   | [get](https://developer.android.com/reference/kotlin/java/io/ObjectInputStream.GetField#get(kotlin.String,%20kotlin.Char))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `val:` `[Char](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char/index.html)`)` Get the value of the named char field from the persistent field.             |
| abstract[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html)               | [get](https://developer.android.com/reference/kotlin/java/io/ObjectInputStream.GetField#get(kotlin.String,%20kotlin.Double))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `val:` `[Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html)`)` Get the value of the named double field from the persistent field.     |
| abstract[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)                 | [get](https://developer.android.com/reference/kotlin/java/io/ObjectInputStream.GetField#get(kotlin.String,%20kotlin.Float))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `val:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`)` Get the value of the named float field from the persistent field.         |
| abstract[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                     | [get](https://developer.android.com/reference/kotlin/java/io/ObjectInputStream.GetField#get(kotlin.String,%20kotlin.Int))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `val:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Get the value of the named int field from the persistent field.                 |
| abstract[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!                    | [get](https://developer.android.com/reference/kotlin/java/io/ObjectInputStream.GetField#get(kotlin.String,%20kotlin.Any))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `val:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!`)` Get the value of the named Object field from the persistent field.             |
| abstract[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)                   | [get](https://developer.android.com/reference/kotlin/java/io/ObjectInputStream.GetField#get(kotlin.String,%20kotlin.Long))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `val:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Get the value of the named long field from the persistent field.             |
| abstract[Short](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-short/index.html)                 | [get](https://developer.android.com/reference/kotlin/java/io/ObjectInputStream.GetField#get(kotlin.String,%20kotlin.Short))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `val:` `[Short](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-short/index.html)`)` Get the value of the named short field from the persistent field.         |
| abstract[ObjectStreamClass](https://developer.android.com/reference/kotlin/java/io/ObjectStreamClass)! | [getObjectStreamClass](https://developer.android.com/reference/kotlin/java/io/ObjectInputStream.GetField#getObjectStreamClass())`()` Get the ObjectStreamClass that describes the fields in the stream.                                                                                                                                                                                       |

## Public constructors

### GetField

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

```
GetField()
```

## Public methods

### defaulted

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

```
abstract fun defaulted(name: String!): Boolean
```

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

|                                                   Parameters                                                    ||
|--------|---------------------------------------------------------------------------------------------------------|
| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the name of the field |

|                                                                Return                                                                 ||
|------------------------------------------------------------------------------------|---------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true, if and only if the named field is defaulted |

|                                                  Exceptions                                                  ||
|--------------------------------------|------------------------------------------------------------------------|
| `java.io.IOException`                | if there are I/O errors while reading from the underlying`InputStream` |
| `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.html#ApiLevels)  

```
abstract fun get(
    name: String!, 
    val: Boolean
): Boolean
```

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

|                                                                    Parameters                                                                     ||
|--------|-------------------------------------------------------------------------------------------------------------------------------------------|
| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the name of the field                                   |
| `val`  | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):the default value to use if`name`does not have a value |

|                                                          Return                                                          ||
|------------------------------------------------------------------------------------|--------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | the value of the named`boolean`field |

|                                                  Exceptions                                                  ||
|--------------------------------------|------------------------------------------------------------------------|
| `java.io.IOException`                | if there are I/O errors while reading from the underlying`InputStream` |
| `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.html#ApiLevels)  

```
abstract fun get(
    name: String!, 
    val: Byte
): Byte
```

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

|                                                                 Parameters                                                                  ||
|--------|-------------------------------------------------------------------------------------------------------------------------------------|
| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the name of the field                             |
| `val`  | [Byte](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte/index.html):the default value to use if`name`does not have a value |

|                                                     Return                                                      ||
|------------------------------------------------------------------------------|-----------------------------------|
| [Byte](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte/index.html) | the value of the named`byte`field |

|                                                  Exceptions                                                  ||
|--------------------------------------|------------------------------------------------------------------------|
| `java.io.IOException`                | if there are I/O errors while reading from the underlying`InputStream` |
| `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.html#ApiLevels)  

```
abstract fun get(
    name: String!, 
    val: Char
): Char
```

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

|                                                                 Parameters                                                                  ||
|--------|-------------------------------------------------------------------------------------------------------------------------------------|
| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the name of the field                             |
| `val`  | [Char](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char/index.html):the default value to use if`name`does not have a value |

|                                                     Return                                                      ||
|------------------------------------------------------------------------------|-----------------------------------|
| [Char](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char/index.html) | the value of the named`char`field |

|                                                  Exceptions                                                  ||
|--------------------------------------|------------------------------------------------------------------------|
| `java.io.IOException`                | if there are I/O errors while reading from the underlying`InputStream` |
| `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.html#ApiLevels)  

```
abstract fun get(
    name: String!, 
    val: Double
): Double
```

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

|                                                                   Parameters                                                                    ||
|--------|-----------------------------------------------------------------------------------------------------------------------------------------|
| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the name of the field                                 |
| `val`  | [Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html):the default value to use if`name`does not have a value |

|                                                        Return                                                         ||
|----------------------------------------------------------------------------------|-------------------------------------|
| [Double](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html) | the value of the named`double`field |

|                                                  Exceptions                                                  ||
|--------------------------------------|------------------------------------------------------------------------|
| `java.io.IOException`                | if there are I/O errors while reading from the underlying`InputStream` |
| `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.html#ApiLevels)  

```
abstract fun get(
    name: String!, 
    val: Float
): Float
```

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

|                                                                  Parameters                                                                   ||
|--------|---------------------------------------------------------------------------------------------------------------------------------------|
| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the name of the field                               |
| `val`  | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):the default value to use if`name`does not have a value |

|                                                       Return                                                       ||
|--------------------------------------------------------------------------------|------------------------------------|
| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html) | the value of the named`float`field |

|                                                  Exceptions                                                  ||
|--------------------------------------|------------------------------------------------------------------------|
| `java.io.IOException`                | if there are I/O errors while reading from the underlying`InputStream` |
| `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.html#ApiLevels)  

```
abstract fun get(
    name: String!, 
    val: Int
): Int
```

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

|                                                                Parameters                                                                 ||
|--------|-----------------------------------------------------------------------------------------------------------------------------------|
| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the name of the field                           |
| `val`  | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the default value to use if`name`does not have a value |

|                                                    Return                                                    ||
|----------------------------------------------------------------------------|----------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | the value of the named`int`field |

|                                                  Exceptions                                                  ||
|--------------------------------------|------------------------------------------------------------------------|
| `java.io.IOException`                | if there are I/O errors while reading from the underlying`InputStream` |
| `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.html#ApiLevels)  

```
abstract fun get(
    name: String!, 
    val: Any!
): Any!
```

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

|                                                                 Parameters                                                                 ||
|--------|------------------------------------------------------------------------------------------------------------------------------------|
| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the name of the field                            |
| `val`  | [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!:the default value to use if`name`does not have a value |

|                                                      Return                                                      ||
|-----------------------------------------------------------------------------|-------------------------------------|
| [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)! | the value of the named`Object`field |

|                                                  Exceptions                                                  ||
|--------------------------------------|------------------------------------------------------------------------|
| `java.io.IOException`                | if there are I/O errors while reading from the underlying`InputStream` |
| `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.html#ApiLevels)  

```
abstract fun get(
    name: String!, 
    val: Long
): Long
```

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

|                                                                 Parameters                                                                  ||
|--------|-------------------------------------------------------------------------------------------------------------------------------------|
| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the name of the field                             |
| `val`  | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html):the default value to use if`name`does not have a value |

|                                                     Return                                                      ||
|------------------------------------------------------------------------------|-----------------------------------|
| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | the value of the named`long`field |

|                                                  Exceptions                                                  ||
|--------------------------------------|------------------------------------------------------------------------|
| `java.io.IOException`                | if there are I/O errors while reading from the underlying`InputStream` |
| `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.html#ApiLevels)  

```
abstract fun get(
    name: String!, 
    val: Short
): Short
```

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

|                                                                  Parameters                                                                   ||
|--------|---------------------------------------------------------------------------------------------------------------------------------------|
| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:the name of the field                               |
| `val`  | [Short](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-short/index.html):the default value to use if`name`does not have a value |

|                                                       Return                                                       ||
|--------------------------------------------------------------------------------|------------------------------------|
| [Short](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-short/index.html) | the value of the named`short`field |

|                                                  Exceptions                                                  ||
|--------------------------------------|------------------------------------------------------------------------|
| `java.io.IOException`                | if there are I/O errors while reading from the underlying`InputStream` |
| `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.html#ApiLevels)  

```
abstract fun getObjectStreamClass(): ObjectStreamClass!
```

Get the ObjectStreamClass that describes the fields in the stream.

|                                                                           Return                                                                            ||
|------------------------------------------------------------------------------------------------|-------------------------------------------------------------|
| [ObjectStreamClass](https://developer.android.com/reference/kotlin/java/io/ObjectStreamClass)! | the descriptor class that describes the serializable fields |