@Test public void testNotFoundMultiBytes() throws IOException { char[] buffer = new char[5]; Reader data = new StringReader("aabbccdd"); PatternDetectingReader in = new PatternDetectingReader(data, "abc"); assertEquals(3, in.read(buffer, 1, 3)); assertEquals(3, in.read(buffer, 1, 3)); assertEquals(2, in.read(buffer, 1, 3)); assertEquals(-1, in.read(buffer, 1, 3)); assertThrows(IOException.class, in::close); }
@Override public int read() throws IOException { char[] buffer = new char[1]; int read = read(buffer); if (read < 0) { return read; } else { return buffer[0]; } }
PatternDetectingReader extends FilterReader { @Override public int read() throws IOException { char[] buffer = new char[1]; int read = read(buffer); if (read < 0) { return read; } else { return buffer[0]; } } }
PatternDetectingReader extends FilterReader { @Override public int read() throws IOException { char[] buffer = new char[1]; int read = read(buffer); if (read < 0) { return read; } else { return buffer[0]; } } PatternDetectingReader(Reader delegate, String pattern); }
PatternDetectingReader extends FilterReader { @Override public int read() throws IOException { char[] buffer = new char[1]; int read = read(buffer); if (read < 0) { return read; } else { return buffer[0]; } } PatternDetectingReader(Reader delegate, String pattern); @Override void close(); @Override int read(); @Override int read(char[] b); @Override int read(char[] b, int off, int len); }
PatternDetectingReader extends FilterReader { @Override public int read() throws IOException { char[] buffer = new char[1]; int read = read(buffer); if (read < 0) { return read; } else { return buffer[0]; } } PatternDetectingReader(Reader delegate, String pattern); @Override void close(); @Override int read(); @Override int read(char[] b); @Override int read(char[] b, int off, int len);  }