1. /*
  2. * %W% %E%
  3. *
  4. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.io;
  8. /**
  9. * Unexpected data appeared in an ObjectInputStream trying to read
  10. * an Object.
  11. * Occurs when the stream contains primitive data
  12. * instead of the object that is expected by readObject.
  13. * The EOF flag in the exception is true indicating that no more
  14. * primitive data is available.
  15. * The count field contains the number of bytes available to read.
  16. *
  17. * @author unascribed
  18. * @version %I%, %G%
  19. * @since JDK1.1
  20. */
  21. public class OptionalDataException extends ObjectStreamException {
  22. /*
  23. * Create an <code>OptionalDataException</code> with a length.
  24. */
  25. OptionalDataException(int len) {
  26. eof = false;
  27. length = len;
  28. }
  29. /*
  30. * Create an <code>OptionalDataException</code> signifing no
  31. * more primitive data is available.
  32. */
  33. OptionalDataException(boolean end) {
  34. length = 0;
  35. eof = end;
  36. }
  37. /**
  38. * The number of bytes of primitive data available to be read
  39. * in the current buffer.
  40. *
  41. * @serial
  42. */
  43. public int length;
  44. /**
  45. * True if there is no more data in the buffered part of the stream.
  46. *
  47. * @serial
  48. */
  49. public boolean eof;
  50. }