code: private void popInput() throws SAXException, IOException {
          String ename = entityStack.removeLast();
  
          if ((ename != null) && doReport) {
              dataBufferFlush();
          }
          switch (sourceType) {
              case INPUT_READER:
                  handler.endExternalEntity(ename);
                  reader.close();
                  break;
              case INPUT_INTERNAL:
                  if ((ename != null) && doReport) {
                      handler.endInternalEntity(ename);
                  }
                  break;
          }
          if (characterHandler != null) {
              characterHandler.end();
          }
          if (normalizationChecker != null) {
              normalizationChecker.end();
          }
  
          // Throw an EOFException if there
          // is nothing else to pop.
          if (inputStack.isEmpty()) {
              throw new EOFException("no more input");
          }
  
          Input input = inputStack.removeLast();
  
          sourceType = input.sourceType;
          readBuffer = input.readBuffer;
          readBufferPos = input.readBufferPos;
          readBufferLength = input.readBufferLength;
          line = input.line;
          linePrev = input.linePrev;
          characterEncoding = input.charecterEncoding;
          readBufferOverflow = input.readBufferOverflow;
          is = input.is;
          currentByteCount = input.currentByteCount;
          column = input.column;
          columnPrev = input.columnPrev;
          nextCharOnNewLine = input.nextCharOnNewLine;
          reader = input.reader;
          prev = input.prev;
          normalizationChecker = input.normalizationChecker;
          characterHandler = input.characterHandler;
      }
docs: Restore a previous input source.
  <p>
  This method restores all of the global variables associated with the
  current input source.
  
  @exception java.io.EOFException
  If there are no more entries on the input stack.
  @see #pushInput
  @see #sourceType
  @see #readBuffer
  @see #readBufferPos
  @see #readBufferLength
  @see #line
  @see #characterEncoding