java.io

Class OptionalDataException

Implemented Interfaces:
Serializable

public class OptionalDataException
extends ObjectStreamException

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:
Since:
JDK1.1
See Also:
Serialized Form

Field Summary

boolean
eof
True if there is no more data in the buffered part of the stream.
int
length
The number of bytes of primitive data available to be read in the current buffer.

Method Summary

Methods inherited from class java.lang.Throwable

fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

eof

public boolean eof
True if there is no more data in the buffered part of the stream.

length

public int length
The number of bytes of primitive data available to be read in the current buffer.
Usages and Demos :

View More Examples of length
   1: 
   2:         if (args.length < 1) {
   3:             usage();
   4:         ...
   5: 
   6:         for (int i = 0; i < args.length; ++i) {
   7:             String arg = args[i];
   8:         ...
   9:                         System.out.println("DeSerialize " + obj.toString());
  10:                     } catch (OptionalDataException e) {
  11:                         if (!e.eof)
  12:         ...
  13:                             System.out.println("Skipping " + e.length + " bytes");

View Full Code Here