< prev index next >

src/java.base/share/classes/java/io/Reader.java

Print this page
rev 58266 : imported patch XXXXXXX-typos


  45  * @see   PushbackReader
  46  * @see PipedReader
  47  * @see StringReader
  48  * @see Writer
  49  *
  50  * @author      Mark Reinhold
  51  * @since       1.1
  52  */
  53 
  54 public abstract class Reader implements Readable, Closeable {
  55 
  56     private static final int TRANSFER_BUFFER_SIZE = 8192;
  57 
  58     /**
  59      * Returns a new {@code Reader} that reads no characters. The returned
  60      * stream is initially open.  The stream is closed by calling the
  61      * {@code close()} method.  Subsequent calls to {@code close()} have no
  62      * effect.
  63      *
  64      * <p> While the stream is open, the {@code read()}, {@code read(char[])},
  65      * {@code read(char[], int, int)}, {@code read(Charbuffer)}, {@code
  66      * ready()}, {@code skip(long)}, and {@code transferTo()} methods all
  67      * behave as if end of stream has been reached. After the stream has been
  68      * closed, these methods all throw {@code IOException}.
  69      *
  70      * <p> The {@code markSupported()} method returns {@code false}.  The
  71      * {@code mark()} and {@code reset()} methods throw an {@code IOException}.
  72      *
  73      * <p> The {@link #lock object} used to synchronize operations on the
  74      * returned {@code Reader} is not specified.
  75      *
  76      * @return a {@code Reader} which reads no characters
  77      *
  78      * @since 11
  79      */
  80     public static Reader nullReader() {
  81         return new Reader() {
  82             private volatile boolean closed;
  83 
  84             private void ensureOpen() throws IOException {
  85                 if (closed) {




  45  * @see   PushbackReader
  46  * @see PipedReader
  47  * @see StringReader
  48  * @see Writer
  49  *
  50  * @author      Mark Reinhold
  51  * @since       1.1
  52  */
  53 
  54 public abstract class Reader implements Readable, Closeable {
  55 
  56     private static final int TRANSFER_BUFFER_SIZE = 8192;
  57 
  58     /**
  59      * Returns a new {@code Reader} that reads no characters. The returned
  60      * stream is initially open.  The stream is closed by calling the
  61      * {@code close()} method.  Subsequent calls to {@code close()} have no
  62      * effect.
  63      *
  64      * <p> While the stream is open, the {@code read()}, {@code read(char[])},
  65      * {@code read(char[], int, int)}, {@code read(CharBuffer)}, {@code
  66      * ready()}, {@code skip(long)}, and {@code transferTo()} methods all
  67      * behave as if end of stream has been reached. After the stream has been
  68      * closed, these methods all throw {@code IOException}.
  69      *
  70      * <p> The {@code markSupported()} method returns {@code false}.  The
  71      * {@code mark()} and {@code reset()} methods throw an {@code IOException}.
  72      *
  73      * <p> The {@link #lock object} used to synchronize operations on the
  74      * returned {@code Reader} is not specified.
  75      *
  76      * @return a {@code Reader} which reads no characters
  77      *
  78      * @since 11
  79      */
  80     public static Reader nullReader() {
  81         return new Reader() {
  82             private volatile boolean closed;
  83 
  84             private void ensureOpen() throws IOException {
  85                 if (closed) {


< prev index next >