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