1. /*
  2. * @(#)ObjectOutput.java 1.11 01/11/29
  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. * ObjectOutput extends the DataOutput interface to include writing of objects.
  10. * DataOutput includes methods for output of primitive types, ObjectOutput
  11. * extends that interface to include objects, arrays, and Strings.
  12. *
  13. * @author unascribed
  14. * @version 1.11, 11/29/01
  15. * @see java.io.InputStream
  16. * @see java.io.ObjectOutputStream
  17. * @see java.io.ObjectInputStream
  18. * @since JDK1.1
  19. */
  20. public interface ObjectOutput extends DataOutput {
  21. /**
  22. * Write an object to the underlying storage or stream. The
  23. * class that implements this interface defines how the object is
  24. * written.
  25. *
  26. * @exception IOException Any of the usual Input/Output related exceptions.
  27. */
  28. public void writeObject(Object obj)
  29. throws IOException;
  30. /**
  31. * Writes a byte. This method will block until the byte is actually
  32. * written.
  33. * @param b the byte
  34. * @exception IOException If an I/O error has occurred.
  35. */
  36. public void write(int b) throws IOException;
  37. /**
  38. * Writes an array of bytes. This method will block until the bytes
  39. * are actually written.
  40. * @param b the data to be written
  41. * @exception IOException If an I/O error has occurred.
  42. */
  43. public void write(byte b[]) throws IOException;
  44. /**
  45. * Writes a sub array of bytes.
  46. * @param b the data to be written
  47. * @param off the start offset in the data
  48. * @param len the number of bytes that are written
  49. * @exception IOException If an I/O error has occurred.
  50. */
  51. public void write(byte b[], int off, int len) throws IOException;
  52. /**
  53. * Flushes the stream. This will write any buffered
  54. * output bytes.
  55. * @exception IOException If an I/O error has occurred.
  56. */
  57. public void flush() throws IOException;
  58. /**
  59. * Closes the stream. This method must be called
  60. * to release any resources associated with the
  61. * stream.
  62. * @exception IOException If an I/O error has occurred.
  63. */
  64. public void close() throws IOException;
  65. }