@Test public void testRead() throws IOException { UnsafeStringReader reader = new UnsafeStringReader("abc"); assertThat(reader.markSupported(), is(true)); assertThat(reader.read(), is((int) 'a')); assertThat(reader.read(), is((int) 'b')); assertThat(reader.read(), is((int) 'c')); assertThat(reader.read(), is(-1)); reader.reset(); reader.mark(0); assertThat(reader.read(), is((int) 'a')); char[] chars = new char[2]; reader.read(chars); reader.close(); assertThat(chars[0], is('b')); assertThat(chars[1], is('c')); }
@Override public int read() throws IOException { ensureOpen(); if (mPosition >= mLimit) return -1; return mString.charAt(mPosition++); }
UnsafeStringReader extends Reader { @Override public int read() throws IOException { ensureOpen(); if (mPosition >= mLimit) return -1; return mString.charAt(mPosition++); } }
UnsafeStringReader extends Reader { @Override public int read() throws IOException { ensureOpen(); if (mPosition >= mLimit) return -1; return mString.charAt(mPosition++); } UnsafeStringReader(String str); }
UnsafeStringReader extends Reader { @Override public int read() throws IOException { ensureOpen(); if (mPosition >= mLimit) return -1; return mString.charAt(mPosition++); } UnsafeStringReader(String str); @Override int read(); @Override int read(char[] cs, int off, int len); @Override long skip(long ns); @Override boolean ready(); @Override boolean markSupported(); @Override void mark(int readAheadLimit); @Override void reset(); @Override void close(); }
UnsafeStringReader extends Reader { @Override public int read() throws IOException { ensureOpen(); if (mPosition >= mLimit) return -1; return mString.charAt(mPosition++); } UnsafeStringReader(String str); @Override int read(); @Override int read(char[] cs, int off, int len); @Override long skip(long ns); @Override boolean ready(); @Override boolean markSupported(); @Override void mark(int readAheadLimit); @Override void reset(); @Override void close();  }