@Test public void notEnoughCharsForTheWindow() { int windowSize = 10; Reader reader = new StringReader(data); LookAheadBufferedReader classUnderTest = new LookAheadBufferedReader(reader, windowSize, true, false); range(0, data.length() - 3).forEach(index -> consume(classUnderTest)); String collectedWindow = classUnderTest.lookAheadAndGetBufferedContent(); assertEquals(windowSize + 2, collectedWindow.length()); assertEquals("NOPQRSTUVYXZ", collectedWindow); }
public String lookAheadAndGetBufferedContent() { try { int ch; while ((ch = super.read()) != -1 && bufferingMode.canAccept(true)) { bufferingMode.forceAppend((char) ch); } } catch (Exception ignore) { } return bufferingMode.toString(); }
LookAheadBufferedReader extends BufferedReader { public String lookAheadAndGetBufferedContent() { try { int ch; while ((ch = super.read()) != -1 && bufferingMode.canAccept(true)) { bufferingMode.forceAppend((char) ch); } } catch (Exception ignore) { } return bufferingMode.toString(); } }
LookAheadBufferedReader extends BufferedReader { public String lookAheadAndGetBufferedContent() { try { int ch; while ((ch = super.read()) != -1 && bufferingMode.canAccept(true)) { bufferingMode.forceAppend((char) ch); } } catch (Exception ignore) { } return bufferingMode.toString(); } LookAheadBufferedReader(Reader in, final int windowSize, boolean isDebugEnabled, boolean isTraceEnabled);  LookAheadBufferedReader(Reader in, final int windowSize, Logger logger);  LookAheadBufferedReader(Reader in, Logger logger); }
LookAheadBufferedReader extends BufferedReader { public String lookAheadAndGetBufferedContent() { try { int ch; while ((ch = super.read()) != -1 && bufferingMode.canAccept(true)) { bufferingMode.forceAppend((char) ch); } } catch (Exception ignore) { } return bufferingMode.toString(); } LookAheadBufferedReader(Reader in, final int windowSize, boolean isDebugEnabled, boolean isTraceEnabled);  LookAheadBufferedReader(Reader in, final int windowSize, Logger logger);  LookAheadBufferedReader(Reader in, Logger logger); @Override int read(); String lookAheadAndGetBufferedContent(); }
LookAheadBufferedReader extends BufferedReader { public String lookAheadAndGetBufferedContent() { try { int ch; while ((ch = super.read()) != -1 && bufferingMode.canAccept(true)) { bufferingMode.forceAppend((char) ch); } } catch (Exception ignore) { } return bufferingMode.toString(); } LookAheadBufferedReader(Reader in, final int windowSize, boolean isDebugEnabled, boolean isTraceEnabled);  LookAheadBufferedReader(Reader in, final int windowSize, Logger logger);  LookAheadBufferedReader(Reader in, Logger logger); @Override int read(); String lookAheadAndGetBufferedContent();  }