/[classpath]/classpath/java/io/Reader.java
ViewVC logotype

Diff of /classpath/java/io/Reader.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9.2.3 by gnu_andrew, Sat Feb 19 10:50:35 2005 UTC revision 1.9.2.4 by tromey, Wed Apr 20 20:27:38 2005 UTC
# Line 1  Line 1 
1  /* Reader.java -- base class of classes that read input as a stream of chars  /* Reader.java -- base class of classes that read input as a stream of chars
2     Copyright (C) 1998, 1999, 2000, 2003, 2004  Free Software Foundation     Copyright (C) 1998, 1999, 2000, 2003, 2004, 2005  Free Software Foundation
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 37  exception statement from your version. * Line 37  exception statement from your version. *
37    
38  package java.io;  package java.io;
39    
40    import java.nio.CharBuffer;
41    
42  /* Written using "Java Class Libraries", 2nd edition, plus online  /* Written using "Java Class Libraries", 2nd edition, plus online
43   * API docs for JDK 1.2 beta from http://www.javasoft.com.   * API docs for JDK 1.2 beta from http://www.javasoft.com.
44   * Status:  Believed complete and correct.   * Status:  Believed complete and correct.
# Line 53  package java.io; Line 55  package java.io;
55   * @date April 21, 1998.     * @date April 21, 1998.  
56   * @author Aaron M. Renn (arenn@urbanophile.com)   * @author Aaron M. Renn (arenn@urbanophile.com)
57   */   */
58  public abstract class Reader implements Closeable  public abstract class Reader implements Closeable, Readable
59  {  {
60    /**    /**
61     * This is the <code>Object</code> used for synchronizing critical code     * This is the <code>Object</code> used for synchronizing critical code
# Line 152  public abstract class Reader implements Line 154  public abstract class Reader implements
154      return count > 0 ? buf[0] : -1;      return count > 0 ? buf[0] : -1;
155    }    }
156    
157      /** @since 1.5 */
158      public int read(CharBuffer buffer) throws IOException
159      {
160        // We want to call put(), so we don't manipulate the CharBuffer
161        // directly.
162        int rem = buffer.remaining();
163        char[] buf = new char[rem];
164        int result = read(buf, 0, rem);
165        if (result != -1)
166          buffer.put(buf, 0, result);
167        return result;
168      }
169    
170    /**    /**
171     * Closes the stream.  Any futher attempts to read from the     * Closes the stream.  Any futher attempts to read from the
172     * stream may generate an <code>IOException</code>.     * stream may generate an <code>IOException</code>.

Legend:
Removed from v.1.9.2.3  
changed lines
  Added in v.1.9.2.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26