PushbackLineNumberReader extends PushbackReader { @Override public int read() throws IOException { int ch = super.read(); if (ch == '\n') { this.lineNumber++; } return ch; } PushbackLineNumberReader(final Reader in);  PushbackLineNumberReader(final Reader in, final int size); @Override int read(); @Override int read(final char[] cbuf); @Override int read(final CharBuffer target); @Override int read(final char[] cbuf, final int off, final int len); String readLine(); @Override void reset(); @Override void unread(final char[] cbuf, final int off, final int len); @Override void unread(final char[] cbuf); @Override void unread(final int c); int getLineNumber(); void skipNewline(); void skipWhitespace(); void skip(final char... chars); @Override String toString();  }
@Test public void testRead() throws IOException { assertEquals('h', lineNumberReader.read()); }