FastStringReader extends Reader { @Override public int read() { return cursor < lim ? str.charAt(cursor++) : -1; } FastStringReader(String str, int lim);  FastStringReader(String str); @Override int read(); @Override int read(char[] cbuf); @Override int read(char[] cbuf, int off, int len); @Override int read(CharBuffer buff); @Override long skip(long n); @Override boolean markSupported(); void mark(); @Override void mark(int readAheadLimit); @Override void reset(); @Override boolean ready(); @Override void close();  }
@Test void testRead() throws IOException { Reader reader = new FastStringReader("ScalaScalaScala"); assertTrue(reader.ready()); assertEquals('S', reader.read()); char[] dst = new char[4]; assertEquals(4, reader.read(dst)); assertArrayEquals(new char[]{'a', 'l', 'a'}, dst); reader.mark(15); CharBuffer buff = CharBuffer.allocate(15); assertEquals(10, reader.read(buff)); assertEquals(5, buff.remaining()); buff.flip(); assertEquals("ScalaScala", buff.toString()); }