1. /*
  2. * @(#)Readable.java 1.3 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.lang;
  8. import java.io.IOException;
  9. /**
  10. * A <tt>Readable</tt> is a source of characters. Characters from
  11. * a <tt>Readable</tt> are made available to callers of the read
  12. * method via a {@link java.nio.CharBuffer CharBuffer}.
  13. *
  14. * @version 1.3 03/12/19
  15. * @since 1.5
  16. */
  17. public interface Readable {
  18. /**
  19. * Attempts to read characters into the specified character buffer.
  20. * The buffer is used as a repository of characters as-is: the only
  21. * changes made are the results of a put operation. No flipping or
  22. * rewinding of the buffer is performed.
  23. *
  24. * @param cb the buffer to read characters into
  25. * @return @return The number of <tt>char</tt> values added to the buffer,
  26. * or -1 if this source of characters is at its end
  27. * @throws IOException if an I/O error occurs
  28. * @throws NullPointerException if cb is null
  29. * @throws ReadOnlyBufferException if cb is a read only buffer
  30. */
  31. public int read(java.nio.CharBuffer cb) throws IOException;
  32. }