code: private void prefetchASCIIEncodingDecl() throws SAXException, IOException {
          int ch;
          readBufferPos = readBufferLength = 0;
  
          is.mark(readBuffer.length);
          while (true) {
              ch = is.read();
              readBuffer[readBufferLength++] = (char) ch;
              switch (ch) {
                  case '>':
                      return;
                  case -1:
                      fatal(
                              "file ends before end of XML or encoding declaration.",
                              null, "?>");
              }
              if (readBuffer.length == readBufferLength) {
                  fatal("unfinished XML or encoding declaration");
              }
          }
      }
docs: Prefetch US-ASCII XML/text decl from input stream into read buffer.
  Doesn't buffer more than absolutely needed, so that when an encoding decl
  says we need to create an InputStreamReader, we can discard our buffer
  and reset(). Caller knows the first chars of the decl exist in the input
  stream.