1. /*
  2. * @(#)ObjectOutput.java 1.16 03/12/19
  3. *
  4. * Copyright 2004 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.16, 12/19/03
  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. * @param obj the object to be written
  27. * @exception IOException Any of the usual Input/Output related exceptions.
  28. */
  29. public void writeObject(Object obj)
  30. throws IOException;
  31. /**
  32. * Writes a byte. This method will block until the byte is actually
  33. * written.
  34. * @param b the byte
  35. * @exception IOException If an I/O error has occurred.
  36. */
  37. public void write(int b) throws IOException;
  38. /**
  39. * Writes an array of bytes. This method will block until the bytes
  40. * are actually written.
  41. * @param b the data to be written
  42. * @exception IOException If an I/O error has occurred.
  43. */
  44. public void write(byte b[]) throws IOException;
  45. /**
  46. * Writes a sub array of bytes.
  47. * @param b the data to be written
  48. * @param off the start offset in the data
  49. * @param len the number of bytes that are written
  50. * @exception IOException If an I/O error has occurred.
  51. */
  52. public void write(byte b[], int off, int len) throws IOException;
  53. /**
  54. * Flushes the stream. This will write any buffered
  55. * output bytes.
  56. * @exception IOException If an I/O error has occurred.
  57. */
  58. public void flush() throws IOException;
  59. /**
  60. * Closes the stream. This method must be called
  61. * to release any resources associated with the
  62. * stream.
  63. * @exception IOException If an I/O error has occurred.
  64. */
  65. public void close() throws IOException;
  66. }