IndentContLineReader extends ContLineReader { public String readLine() throws IOException { String s; if (prevLine != null) { s = prevLine; prevLine = null; } else { s = readPhysicalLine(); } firstLineNumber = super.getLineNumber(); if (!doContinue || s == null) return s; StringBuilder sb = new StringBuilder(s); while (true) { String nextPart = readPhysicalLine(); if (nextPart == null) { return sb.toString(); } if (nextPart.length() > 0 && Character.isWhitespace(nextPart.charAt(0))) { sb.append(nextPart); } else { prevLine = nextPart; break; } } return sb.toString(); } IndentContLineReader(Reader in);  IndentContLineReader(Reader in, int sz); int getLineNumber(); String readLine();  }
@Test public void testTwoLiner() throws IOException { String input = "Received: by foo.bar.com\n" + " at 12:34:56 January 1, 2000\n"; String expected = "Received: by foo.bar.com at 12:34:56 January 1, 2000"; try (IndentContLineReader is = new IndentContLineReader( new StringReader(input))) { assertEquals("2 liner", expected, is.readLine()); } }