@Test public void testSkipTooLong() throws IOException { UnsafeStringReader reader = new UnsafeStringReader("abc"); reader.skip(10); long skip = reader.skip(10); assertThat(skip, is(0L)); }
@Override public long skip(long ns) throws IOException { ensureOpen(); if (mPosition >= mLimit) return 0; long n = Math.min(mLimit - mPosition, ns); n = Math.max(-mPosition, n); mPosition += n; return n; }
UnsafeStringReader extends Reader { @Override public long skip(long ns) throws IOException { ensureOpen(); if (mPosition >= mLimit) return 0; long n = Math.min(mLimit - mPosition, ns); n = Math.max(-mPosition, n); mPosition += n; return n; } }
UnsafeStringReader extends Reader { @Override public long skip(long ns) throws IOException { ensureOpen(); if (mPosition >= mLimit) return 0; long n = Math.min(mLimit - mPosition, ns); n = Math.max(-mPosition, n); mPosition += n; return n; } UnsafeStringReader(String str); }
UnsafeStringReader extends Reader { @Override public long skip(long ns) throws IOException { ensureOpen(); if (mPosition >= mLimit) return 0; long n = Math.min(mLimit - mPosition, ns); n = Math.max(-mPosition, n); mPosition += n; return n; } 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 long skip(long ns) throws IOException { ensureOpen(); if (mPosition >= mLimit) return 0; long n = Math.min(mLimit - mPosition, ns); n = Math.max(-mPosition, n); mPosition += n; return n; } 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();  }