@Test(expected=IOException.class) public void testBad() throws Exception { String testData = "This tests for line ending in \\"; EscapeContLineReader is = new EscapeContLineReader( new StringReader(testData)); is.readLine(); is.readLine(); is.close(); }
public String readLine() throws IOException { String s = readPhysicalLine(); if (s == null) hitEOF = true; if (hitEOF) return null; StringBuilder sb = new StringBuilder(s); firstLineNumber = super.getLineNumber(); while (sb.length() > 0 && sb.charAt(sb.length() - 1) == escape) { sb.setLength(sb.length() - 1); String nextPart = readPhysicalLine(); if (nextPart == null) { hitEOF = true; throw new IOException( "EOF within continued line at line " + firstLineNumber); } sb.append(' ').append(nextPart); } return sb.toString(); }
EscapeContLineReader extends ContLineReader { public String readLine() throws IOException { String s = readPhysicalLine(); if (s == null) hitEOF = true; if (hitEOF) return null; StringBuilder sb = new StringBuilder(s); firstLineNumber = super.getLineNumber(); while (sb.length() > 0 && sb.charAt(sb.length() - 1) == escape) { sb.setLength(sb.length() - 1); String nextPart = readPhysicalLine(); if (nextPart == null) { hitEOF = true; throw new IOException( "EOF within continued line at line " + firstLineNumber); } sb.append(' ').append(nextPart); } return sb.toString(); } }
EscapeContLineReader extends ContLineReader { public String readLine() throws IOException { String s = readPhysicalLine(); if (s == null) hitEOF = true; if (hitEOF) return null; StringBuilder sb = new StringBuilder(s); firstLineNumber = super.getLineNumber(); while (sb.length() > 0 && sb.charAt(sb.length() - 1) == escape) { sb.setLength(sb.length() - 1); String nextPart = readPhysicalLine(); if (nextPart == null) { hitEOF = true; throw new IOException( "EOF within continued line at line " + firstLineNumber); } sb.append(' ').append(nextPart); } return sb.toString(); } EscapeContLineReader(Reader in);  EscapeContLineReader(Reader in, int sz);  EscapeContLineReader(Reader in, char esc); }
EscapeContLineReader extends ContLineReader { public String readLine() throws IOException { String s = readPhysicalLine(); if (s == null) hitEOF = true; if (hitEOF) return null; StringBuilder sb = new StringBuilder(s); firstLineNumber = super.getLineNumber(); while (sb.length() > 0 && sb.charAt(sb.length() - 1) == escape) { sb.setLength(sb.length() - 1); String nextPart = readPhysicalLine(); if (nextPart == null) { hitEOF = true; throw new IOException( "EOF within continued line at line " + firstLineNumber); } sb.append(' ').append(nextPart); } return sb.toString(); } EscapeContLineReader(Reader in);  EscapeContLineReader(Reader in, int sz);  EscapeContLineReader(Reader in, char esc); int getLineNumber(); String readLine(); }
EscapeContLineReader extends ContLineReader { public String readLine() throws IOException { String s = readPhysicalLine(); if (s == null) hitEOF = true; if (hitEOF) return null; StringBuilder sb = new StringBuilder(s); firstLineNumber = super.getLineNumber(); while (sb.length() > 0 && sb.charAt(sb.length() - 1) == escape) { sb.setLength(sb.length() - 1); String nextPart = readPhysicalLine(); if (nextPart == null) { hitEOF = true; throw new IOException( "EOF within continued line at line " + firstLineNumber); } sb.append(' ').append(nextPart); } return sb.toString(); } EscapeContLineReader(Reader in);  EscapeContLineReader(Reader in, int sz);  EscapeContLineReader(Reader in, char esc); int getLineNumber(); String readLine(); static final char ESCAPE; }