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