Stay organized with collections
Save and categorize content based on your preferences.
PutField
abstract class PutField
Provide programmatic access to the persistent fields to be written to ObjectOutput.
Summary
Public methods |
abstract Unit |
Put the value of the named boolean field into the persistent field.
|
abstract Unit |
Put the value of the named byte field into the persistent field.
|
abstract Unit |
Put the value of the named char field into the persistent field.
|
abstract Unit |
Put the value of the named double field into the persistent field.
|
abstract Unit |
Put the value of the named float field into the persistent field.
|
abstract Unit |
Put the value of the named int field into the persistent field.
|
abstract Unit |
Put the value of the named Object field into the persistent field.
|
abstract Unit |
Put the value of the named long field into the persistent field.
|
abstract Unit |
Put the value of the named short field into the persistent field.
|
abstract Unit |
Write the data and fields to the specified ObjectOutput stream, which must be the same stream that produced this PutField object.
|
Public constructors
Public methods
put
abstract fun put(
name: String!,
val: Boolean
): Unit
Put the value of the named boolean field into the persistent field.
Parameters |
name |
String!: the name of the serializable field |
val |
Boolean: the value to assign to the field |
Exceptions |
java.lang.IllegalArgumentException |
if name does not match the name of a serializable field for the class whose fields are being written, or if the type of the named field is not boolean |
put
abstract fun put(
name: String!,
val: Byte
): Unit
Put the value of the named byte field into the persistent field.
Parameters |
name |
String!: the name of the serializable field |
val |
Byte: the value to assign to the field |
Exceptions |
java.lang.IllegalArgumentException |
if name does not match the name of a serializable field for the class whose fields are being written, or if the type of the named field is not byte |
put
abstract fun put(
name: String!,
val: Char
): Unit
Put the value of the named char field into the persistent field.
Parameters |
name |
String!: the name of the serializable field |
val |
Char: the value to assign to the field |
Exceptions |
java.lang.IllegalArgumentException |
if name does not match the name of a serializable field for the class whose fields are being written, or if the type of the named field is not char |
put
abstract fun put(
name: String!,
val: Double
): Unit
Put the value of the named double field into the persistent field.
Parameters |
name |
String!: the name of the serializable field |
val |
Double: the value to assign to the field |
Exceptions |
java.lang.IllegalArgumentException |
if name does not match the name of a serializable field for the class whose fields are being written, or if the type of the named field is not double |
put
abstract fun put(
name: String!,
val: Float
): Unit
Put the value of the named float field into the persistent field.
Parameters |
name |
String!: the name of the serializable field |
val |
Float: the value to assign to the field |
Exceptions |
java.lang.IllegalArgumentException |
if name does not match the name of a serializable field for the class whose fields are being written, or if the type of the named field is not float |
put
abstract fun put(
name: String!,
val: Int
): Unit
Put the value of the named int field into the persistent field.
Parameters |
name |
String!: the name of the serializable field |
val |
Int: the value to assign to the field |
Exceptions |
java.lang.IllegalArgumentException |
if name does not match the name of a serializable field for the class whose fields are being written, or if the type of the named field is not int |
put
abstract fun put(
name: String!,
val: Any!
): Unit
Put the value of the named Object field into the persistent field.
Parameters |
name |
String!: the name of the serializable field |
val |
Any!: the value to assign to the field (which may be null ) |
Exceptions |
java.lang.IllegalArgumentException |
if name does not match the name of a serializable field for the class whose fields are being written, or if the type of the named field is not a reference type |
put
abstract fun put(
name: String!,
val: Long
): Unit
Put the value of the named long field into the persistent field.
Parameters |
name |
String!: the name of the serializable field |
val |
Long: the value to assign to the field |
Exceptions |
java.lang.IllegalArgumentException |
if name does not match the name of a serializable field for the class whose fields are being written, or if the type of the named field is not long |
put
abstract fun put(
name: String!,
val: Short
): Unit
Put the value of the named short field into the persistent field.
Parameters |
name |
String!: the name of the serializable field |
val |
Short: the value to assign to the field |
Exceptions |
java.lang.IllegalArgumentException |
if name does not match the name of a serializable field for the class whose fields are being written, or if the type of the named field is not short |
write
abstract fun write(out: ObjectOutput!): Unit
Deprecated: This method does not write the values contained by this PutField
object in a proper format, and may result in corruption of the serialization stream. The correct way to write PutField
data is by calling the java.io.ObjectOutputStream#writeFields()
method.
Write the data and fields to the specified ObjectOutput stream, which must be the same stream that produced this PutField
object.
Parameters |
out |
ObjectOutput!: the stream to write the data and fields to |
Exceptions |
java.io.IOException |
if I/O errors occur while writing to the underlying stream |
java.lang.IllegalArgumentException |
if the specified stream is not the same stream that produced this PutField object |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[]]