1. /*
  2. * @(#)FilterReader.java 1.11 00/02/02
  3. *
  4. * Copyright 1996-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.io;
  11. /**
  12. * Abstract class for reading filtered character streams.
  13. *
  14. * @version 1.11, 00/02/02
  15. * @author Mark Reinhold
  16. * @since JDK1.1
  17. */
  18. public abstract class FilterReader extends Reader {
  19. /**
  20. * The underlying character-input stream, or null if the stream has been
  21. * closed.
  22. */
  23. protected Reader in;
  24. /**
  25. * Create a new filtered reader.
  26. *
  27. * @param in a Reader object providing the underlying stream.
  28. */
  29. protected FilterReader(Reader in) {
  30. super(in);
  31. this.in = in;
  32. }
  33. /**
  34. * Read a single character.
  35. *
  36. * @exception IOException If an I/O error occurs
  37. */
  38. public int read() throws IOException {
  39. return in.read();
  40. }
  41. /**
  42. * Read characters into a portion of an array.
  43. *
  44. * @exception IOException If an I/O error occurs
  45. */
  46. public int read(char cbuf[], int off, int len) throws IOException {
  47. return in.read(cbuf, off, len);
  48. }
  49. /**
  50. * Skip characters.
  51. *
  52. * @exception IOException If an I/O error occurs
  53. */
  54. public long skip(long n) throws IOException {
  55. return in.skip(n);
  56. }
  57. /**
  58. * Tell whether this stream is ready to be read.
  59. *
  60. * @exception IOException If an I/O error occurs
  61. */
  62. public boolean ready() throws IOException {
  63. return in.ready();
  64. }
  65. /**
  66. * Tell whether this stream supports the mark() operation.
  67. */
  68. public boolean markSupported() {
  69. return in.markSupported();
  70. }
  71. /**
  72. * Mark the present position in the stream.
  73. *
  74. * @exception IOException If an I/O error occurs
  75. */
  76. public void mark(int readAheadLimit) throws IOException {
  77. in.mark(readAheadLimit);
  78. }
  79. /**
  80. * Reset the stream.
  81. *
  82. * @exception IOException If an I/O error occurs
  83. */
  84. public void reset() throws IOException {
  85. in.reset();
  86. }
  87. /**
  88. * Close the stream.
  89. *
  90. * @exception IOException If an I/O error occurs
  91. */
  92. public void close() throws IOException {
  93. in.close();
  94. }
  95. }