private void pushInput(String ename) throws SAXException {
        // Protect against billion laughs -- 2006-12-28 hsivonen
        if (entityStack.size() > 16) {
            fatal("Entity recursion too deep. Stopping to protect against denial of service attacks.");
        }

        // Check for entity recursion.
        if (ename != null) {
            Iterator<String> entities = entityStack.iterator();
            while (entities.hasNext()) {
                String e = entities.next();
                if ((e != null) && (e == ename)) {
                    fatal("recursive reference to entity", ename, null);
                }
            }
        }
        entityStack.addLast(ename);

        // Don't bother if there is no current input.
        if (sourceType == INPUT_NONE) {
            return;
        }

        // Set up a snapshot of the current
        // input source.
        Input input = new Input();

        input.sourceType = sourceType;
        input.readBuffer = readBuffer;
        input.readBufferPos = readBufferPos;
        input.readBufferLength = readBufferLength;
        input.line = line;
        input.linePrev = linePrev;
        input.charecterEncoding = characterEncoding;
        input.readBufferOverflow = readBufferOverflow;
        input.is = is;
        input.currentByteCount = currentByteCount;
        input.column = column;
        input.columnPrev = columnPrev;
        input.nextCharOnNewLine = nextCharOnNewLine;
        input.reader = reader;
        input.prev = prev;
        input.normalizationChecker = normalizationChecker;
        input.characterHandler = characterHandler;
        characterHandler = null;

        // Push it onto the stack.
        inputStack.addLast(input);
    }
Save the current input source onto the stack.
<p>
This method saves all of the global variables associated with the current
input source, so that they can be restored when a new input source has
finished. It also tests for entity recursion.
<p>
The method saves the following global variables onto a stack using a
fixed-length array:
<ol>
<li>sourceType
<li>externalEntity
<li>readBuffer
<li>readBufferPos
<li>readBufferLength
<li>line
<li>characterEncoding
</ol>

@param ename
           The name of the entity (if any) causing the new input.
@see #popInput
@see #sourceType
@see #externalEntity
@see #readBuffer
@see #readBufferPos
@see #readBufferLength
@see #line
@see #characterEncoding
src/nu/validator/gnu/xml/aelfred2/XmlParser.java