Exception indicating the failure of an object read operation due to
unread primitive data, or the end of data belonging to a serialized
object in the stream. This exception may be thrown in two cases:
An attempt was made to read an object when the next element in the
stream is primitive data. In this case, the OptionalDataException's
length field is set to the number of bytes of primitive data
immediately readable from the stream, and the eof field is set to
false.
An attempt was made to read past the end of data consumable by a
class-defined readObject or readExternal method. In this case, the
OptionalDataException's eof field is set to true, and the length field
is set to 0.
Returns an array containing all of the exceptions that were
suppressed, typically by the try-with-resources
statement, in order to deliver this exception.
[[["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 2024-07-10 UTC."],[],["`OptionalDataException` signals a failed object read due to unread primitive data or reaching the end of a serialized object's data. The exception's `length` field indicates the number of readable primitive data bytes. If `eof` is true, it means the end of the object's data was reached, and `length` will be 0. Otherwise, `eof` is false and the stream contains unread primitive data. The class extends `ObjectStreamException`. It also inherits from `Throwable` and `Object`, containing methods to manage stack trace, causes and object information.\n"]]