Class InvalidXmlStreamReader

  • All Implemented Interfaces:
    Closeable, AutoCloseable, Readable

    public class InvalidXmlStreamReader
    extends FilterReader
    Provides similar functionality to org.apache.commons.io.input.XmlStreamReader plus replacing invalid xml characters.
    • Constructor Detail

      • InvalidXmlStreamReader

        public InvalidXmlStreamReader​(InputStream in,
                                      char replacement)
                               throws IOException
        Constructs a new reader.
        Parameters:
        in - the underlying stream.
        replacement - the replacement character for invalid xml characters.
        Throws:
        IOException
    • Method Detail

      • read

        public int read()
                 throws IOException
        Invokes the in's read() method, detecting and skipping invalid xml characters
        Overrides:
        read in class FilterReader
        Returns:
        the character read (excluding invalid xml characters) or -1 if the end of stream
        Throws:
        IOException - if an I/O error occurs
      • read

        public int read​(char[] cbuf,
                        int off,
                        int len)
                 throws IOException
        Invokes the in's read(byte[], int, int) method, detecting and skipping invalid xml.
        Overrides:
        read in class FilterReader
        Parameters:
        cbuf - the buffer to read the characters into
        off - The start offset
        len - The maximum number of characters to read
        Returns:
        the number of characters read or -1 if the end of stream
        Throws:
        IOException - if an I/O error occurs