1. /*
  2. * @(#)ObjectInput.java 1.16 00/02/02
  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. * ObjectInput extends the DataInput interface to include the reading of
  13. * objects. DataInput includes methods for the input of primitive types,
  14. * ObjectInput extends that interface to include objects, arrays, and Strings.
  15. *
  16. * @author unascribed
  17. * @version 1.16, 02/02/00
  18. * @see java.io.InputStream
  19. * @see java.io.ObjectOutputStream
  20. * @see java.io.ObjectInputStream
  21. * @since JDK1.1
  22. */
  23. public interface ObjectInput extends DataInput {
  24. /**
  25. * Read and return an object. The class that implements this interface
  26. * defines where the object is "read" from.
  27. *
  28. * @return the object read from the stream
  29. * @exception java.lang.ClassNotFoundException If the class of a serialized
  30. * object cannot be found.
  31. * @exception IOException If any of the usual Input/Output
  32. * related exceptions occur.
  33. */
  34. public Object readObject()
  35. throws ClassNotFoundException, IOException;
  36. /**
  37. * Reads a byte of data. This method will block if no input is
  38. * available.
  39. * @return the byte read, or -1 if the end of the
  40. * stream is reached.
  41. * @exception IOException If an I/O error has occurred.
  42. */
  43. public int read() throws IOException;
  44. /**
  45. * Reads into an array of bytes. This method will
  46. * block until some input is available.
  47. * @param b the buffer into which the data is read
  48. * @return the actual number of bytes read, -1 is
  49. * returned when the end of the stream is reached.
  50. * @exception IOException If an I/O error has occurred.
  51. */
  52. public int read(byte b[]) throws IOException;
  53. /**
  54. * Reads into an array of bytes. This method will
  55. * block until some input is available.
  56. * @param b the buffer into which the data is read
  57. * @param off the start offset of the data
  58. * @param len the maximum number of bytes read
  59. * @return the actual number of bytes read, -1 is
  60. * returned when the end of the stream is reached.
  61. * @exception IOException If an I/O error has occurred.
  62. */
  63. public int read(byte b[], int off, int len) throws IOException;
  64. /**
  65. * Skips n bytes of input.
  66. * @param n the number of bytes to be skipped
  67. * @return the actual number of bytes skipped.
  68. * @exception IOException If an I/O error has occurred.
  69. */
  70. public long skip(long n) throws IOException;
  71. /**
  72. * Returns the number of bytes that can be read
  73. * without blocking.
  74. * @return the number of available bytes.
  75. * @exception IOException If an I/O error has occurred.
  76. */
  77. public int available() throws IOException;
  78. /**
  79. * Closes the input stream. Must be called
  80. * to release any resources associated with
  81. * the stream.
  82. * @exception IOException If an I/O error has occurred.
  83. */
  84. public void close() throws IOException;
  85. }