Class AsciiReader

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.lang.Readable

    public final class AsciiReader
    extends BaseReader
    Optimized Reader that reads ascii content from an input stream. In addition to doing (hopefully) optimal conversion, it can also take array of "pre-read" (leftover) bytes; this is necessary when preliminary stream/reader is trying to figure out XML encoding.
    • Field Detail

      • mXml11

        boolean mXml11
      • mCharCount

        int mCharCount
        Total read character count; used for error reporting purposes (note: byte count is the same, due to fixed one-byte-per char mapping)
    • Constructor Detail

      • AsciiReader

        public AsciiReader​(ReaderConfig cfg,
                           java.io.InputStream in,
                           byte[] buf,
                           int ptr,
                           int len,
                           boolean recycleBuffer)
    • Method Detail

      • setXmlCompliancy

        public void setXmlCompliancy​(int xmlVersion)
        Description copied from class: BaseReader
        Method that can be called to indicate the xml conformance used when reading content using this reader. Some of the character validity checks need to be done at reader level, and sometimes they depend on xml level (for example, xml 1.1 has new linefeeds and both more and less restricted characters).
        Specified by:
        setXmlCompliancy in class BaseReader
      • read

        public int read​(char[] cbuf,
                        int start,
                        int len)
                 throws java.io.IOException
        Specified by:
        read in class java.io.Reader
        Throws:
        java.io.IOException
      • reportInvalidAscii

        private void reportInvalidAscii​(char c)
                                 throws java.io.IOException
        Throws:
        java.io.IOException