@Test public void testBadXmlFileReadWithBufferedReaderReadLines() throws IOException { String fileName = getClass().getResource("/responses/problematic/spanish_bad_xml.gz").getFile(); File file = new File(fileName); FileInputStream fis = new FileInputStream(file); GZIPInputStream inputStream = new GZIPInputStream(fis); StringBuilder sb = new StringBuilder(); try (BufferedReader buffReader = new BufferedReader( new XmlSanitizingReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)))) { while (buffReader.ready()) { String line = buffReader.readLine(); sb.append(line); } } assertEquals(6097, sb.toString().trim().length()); }
@Override public boolean ready() throws IOException { return (!endOfStreamReached && in.ready()); }
XmlSanitizingReader extends FilterReader { @Override public boolean ready() throws IOException { return (!endOfStreamReached && in.ready()); } }
XmlSanitizingReader extends FilterReader { @Override public boolean ready() throws IOException { return (!endOfStreamReached && in.ready()); } XmlSanitizingReader(Reader in); }
XmlSanitizingReader extends FilterReader { @Override public boolean ready() throws IOException { return (!endOfStreamReached && in.ready()); } XmlSanitizingReader(Reader in); @Override synchronized int read(); @Override synchronized int read(char[] buffer, int offset, int length); @Override boolean ready(); @Override synchronized void close(); @Override boolean markSupported(); }
XmlSanitizingReader extends FilterReader { @Override public boolean ready() throws IOException { return (!endOfStreamReached && in.ready()); } XmlSanitizingReader(Reader in); @Override synchronized int read(); @Override synchronized int read(char[] buffer, int offset, int length); @Override boolean ready(); @Override synchronized void close(); @Override boolean markSupported();  }