@Test public void readWithCharBufferAndLegalText() throws IOException { cut = new EscapingReader(new StringReader("legal")); final CharBuffer buffer = CharBuffer.allocate(10); assertEquals(5, cut.read(buffer)); buffer.flip(); assertEquals("legal", buffer.toString()); }
@Override public int read() throws IOException { int fromDelegate = delegate.read(); if (fromDelegate < 0) { return fromDelegate; } char c = (char) fromDelegate; while (invalidCharsPattern.matcher(String.valueOf(c)).find()) { fromDelegate = delegate.read(); if (fromDelegate < 0) { return fromDelegate; } c = (char) fromDelegate; } return fromDelegate; }
EscapingReader extends Reader { @Override public int read() throws IOException { int fromDelegate = delegate.read(); if (fromDelegate < 0) { return fromDelegate; } char c = (char) fromDelegate; while (invalidCharsPattern.matcher(String.valueOf(c)).find()) { fromDelegate = delegate.read(); if (fromDelegate < 0) { return fromDelegate; } c = (char) fromDelegate; } return fromDelegate; } }
EscapingReader extends Reader { @Override public int read() throws IOException { int fromDelegate = delegate.read(); if (fromDelegate < 0) { return fromDelegate; } char c = (char) fromDelegate; while (invalidCharsPattern.matcher(String.valueOf(c)).find()) { fromDelegate = delegate.read(); if (fromDelegate < 0) { return fromDelegate; } c = (char) fromDelegate; } return fromDelegate; } EscapingReader(Reader delegate);  EscapingReader(Object lock, Reader delegate); }
EscapingReader extends Reader { @Override public int read() throws IOException { int fromDelegate = delegate.read(); if (fromDelegate < 0) { return fromDelegate; } char c = (char) fromDelegate; while (invalidCharsPattern.matcher(String.valueOf(c)).find()) { fromDelegate = delegate.read(); if (fromDelegate < 0) { return fromDelegate; } c = (char) fromDelegate; } return fromDelegate; } EscapingReader(Reader delegate);  EscapingReader(Object lock, Reader delegate); @Override int read(); @Override int read(char[] cbuf, int off, int len); @Override long skip(long n); @Override boolean ready(); @Override boolean markSupported(); @Override void mark(int readAheadLimit); @Override void reset(); @Override void close(); }
EscapingReader extends Reader { @Override public int read() throws IOException { int fromDelegate = delegate.read(); if (fromDelegate < 0) { return fromDelegate; } char c = (char) fromDelegate; while (invalidCharsPattern.matcher(String.valueOf(c)).find()) { fromDelegate = delegate.read(); if (fromDelegate < 0) { return fromDelegate; } c = (char) fromDelegate; } return fromDelegate; } EscapingReader(Reader delegate);  EscapingReader(Object lock, Reader delegate); @Override int read(); @Override int read(char[] cbuf, int off, int len); @Override long skip(long n); @Override boolean ready(); @Override boolean markSupported(); @Override void mark(int readAheadLimit); @Override void reset(); @Override void close();  }