@Test public void testSkip() throws IOException { Reader r = new ExpandTabsReader(new StringReader("\txyz"), 8); long toSkip = 4; while (toSkip > 0) { long skipped = r.skip(toSkip); assertTrue(skipped > 0); assertTrue(skipped <= toSkip); toSkip -= skipped; } StringBuilder sb = new StringBuilder(); int c; while ((c = r.read()) != -1) { sb.append((char) c); } assertEquals(" xyz", sb.toString()); }
@Override public long skip(long n) throws IOException { if (n < 0L) { throw new IllegalArgumentException("n is negative"); } long skipped = 0; for (long l = 0; l < n; l++) { int c = read(); if (c == -1) { break; } skipped++; } return skipped; }
ExpandTabsReader extends FilterReader { @Override public long skip(long n) throws IOException { if (n < 0L) { throw new IllegalArgumentException("n is negative"); } long skipped = 0; for (long l = 0; l < n; l++) { int c = read(); if (c == -1) { break; } skipped++; } return skipped; } }
ExpandTabsReader extends FilterReader { @Override public long skip(long n) throws IOException { if (n < 0L) { throw new IllegalArgumentException("n is negative"); } long skipped = 0; for (long l = 0; l < n; l++) { int c = read(); if (c == -1) { break; } skipped++; } return skipped; } ExpandTabsReader(Reader in, int tabSize); }
ExpandTabsReader extends FilterReader { @Override public long skip(long n) throws IOException { if (n < 0L) { throw new IllegalArgumentException("n is negative"); } long skipped = 0; for (long l = 0; l < n; l++) { int c = read(); if (c == -1) { break; } skipped++; } return skipped; } ExpandTabsReader(Reader in, int tabSize); static Reader wrap(Reader in, Project p); static Reader wrap(Reader in, int tabSize); static int translate(String line, int column, int tabSize); @Override int read(); @Override int read(char[] cbuf, int off, int len); @Override long skip(long n); @Override boolean markSupported(); }
ExpandTabsReader extends FilterReader { @Override public long skip(long n) throws IOException { if (n < 0L) { throw new IllegalArgumentException("n is negative"); } long skipped = 0; for (long l = 0; l < n; l++) { int c = read(); if (c == -1) { break; } skipped++; } return skipped; } ExpandTabsReader(Reader in, int tabSize); static Reader wrap(Reader in, Project p); static Reader wrap(Reader in, int tabSize); static int translate(String line, int column, int tabSize); @Override int read(); @Override int read(char[] cbuf, int off, int len); @Override long skip(long n); @Override boolean markSupported();  }