001 package railo.commons.io; 002 003 import java.io.IOException; 004 import java.io.Reader; 005 import java.nio.CharBuffer; 006 007 public final class CountingReader extends Reader { 008 009 private final Reader reader; 010 private int count=0; 011 012 public CountingReader(Reader reader) { 013 this.reader=reader; 014 } 015 @Override 016 public void mark(int readAheadLimit) throws IOException { 017 reader.mark(readAheadLimit); 018 } 019 020 @Override 021 public boolean markSupported() { 022 return reader.markSupported(); 023 } 024 025 @Override 026 public int read() throws IOException { 027 count++; 028 return reader.read(); 029 } 030 031 @Override 032 public int read(char[] cbuf) throws IOException { 033 034 return reader.read(cbuf); 035 } 036 037 @Override 038 public int read(CharBuffer arg0) throws IOException { 039 return super.read(arg0.array()); 040 } 041 042 @Override 043 public boolean ready() throws IOException { 044 // TODO Auto-generated method stub 045 return super.ready(); 046 } 047 048 @Override 049 public void reset() throws IOException { 050 // TODO Auto-generated method stub 051 super.reset(); 052 } 053 054 @Override 055 public long skip(long n) throws IOException { 056 // TODO Auto-generated method stub 057 return super.skip(n); 058 } 059 060 public void close() throws IOException { 061 // TODO Auto-generated method stub 062 063 } 064 065 public int read(char[] cbuf, int off, int len) throws IOException { 066 // TODO Auto-generated method stub 067 return 0; 068 } 069 070 }