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