com.sun.org.apache.xerces.internal.impl.XMLScanner.NameType Java Examples

The following examples show how to use com.sun.org.apache.xerces.internal.impl.XMLScanner.NameType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XMLEntityScanner.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * If the current entity is an Entity reference, check the accumulated size
 * against the limit.
 *
 * @param nt type of name (element, attribute or entity)
 * @param entity The current entity
 * @param offset The index of the first byte
 * @param length The length of the entity scanned
 */
protected void checkEntityLimit(NameType nt, ScannedEntity entity, int offset, int length) {
    if (entity == null || !entity.isGE) {
        return;
    }

    if (nt != NameType.REFERENCE) {
        checkLimit(Limit.GENERAL_ENTITY_SIZE_LIMIT, entity, offset, length);
    }
    if (nt == NameType.ELEMENTSTART || nt == NameType.ATTRIBUTENAME) {
        checkNodeCount(entity);
    }
}
 
Example #2
Source File: XMLEntityScanner.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the current entity is an Entity reference, check the accumulated size
 * against the limit.
 *
 * @param nt type of name (element, attribute or entity)
 * @param entity The current entity
 * @param offset The index of the first byte
 * @param length The length of the entity scanned
 */
protected void checkEntityLimit(NameType nt, ScannedEntity entity, int offset, int length) {
    if (entity == null || !entity.isGE) {
        return;
    }

    if (nt != NameType.REFERENCE) {
        checkLimit(Limit.GENERAL_ENTITY_SIZE_LIMIT, entity, offset, length);
    }
    if (nt == NameType.ELEMENTSTART || nt == NameType.ATTRIBUTENAME) {
        checkNodeCount(entity);
    }
}
 
Example #3
Source File: XML11EntityScanner.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the next character on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed.
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected int scanChar(NameType nt) throws IOException {

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // scan character
    int offset = fCurrentEntity.position;
    int c = fCurrentEntity.ch[fCurrentEntity.position++];
    boolean external = false;
    if (c == '\n' ||
        ((c == '\r' || c == 0x85 || c == 0x2028) && (external = fCurrentEntity.isExternal()))) {
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)c;
            load(1, false, false);
            offset = 0;
        }
        if (c == '\r' && external) {
            int cc = fCurrentEntity.ch[fCurrentEntity.position++];
            if (cc != '\n' && cc != 0x85) {
                fCurrentEntity.position--;
            }
        }
        c = '\n';
    }

    // return character that was scanned
    fCurrentEntity.columnNumber++;
    if (!detectingVersion) {
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
    }
    return c;

}
 
Example #4
Source File: XMLEntityScanner.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the current entity is an Entity reference, check the accumulated size
 * against the limit.
 *
 * @param nt type of name (element, attribute or entity)
 * @param entity The current entity
 * @param offset The index of the first byte
 * @param length The length of the entity scanned
 */
protected void checkEntityLimit(NameType nt, ScannedEntity entity, int offset, int length) {
    if (entity == null || !entity.isGE) {
        return;
    }

    if (nt != NameType.REFERENCE) {
        checkLimit(Limit.GENERAL_ENTITY_SIZE_LIMIT, entity, offset, length);
    }
    if (nt == NameType.ELEMENTSTART || nt == NameType.ATTRIBUTENAME) {
        checkNodeCount(entity);
    }
}
 
Example #5
Source File: XML11EntityScanner.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the next character on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed.
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected int scanChar(NameType nt) throws IOException {

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // scan character
    int offset = fCurrentEntity.position;
    int c = fCurrentEntity.ch[fCurrentEntity.position++];
    boolean external = false;
    if (c == '\n' ||
        ((c == '\r' || c == 0x85 || c == 0x2028) && (external = fCurrentEntity.isExternal()))) {
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)c;
            load(1, false, false);
            offset = 0;
        }
        if (c == '\r' && external) {
            int cc = fCurrentEntity.ch[fCurrentEntity.position++];
            if (cc != '\n' && cc != 0x85) {
                fCurrentEntity.position--;
            }
        }
        c = '\n';
    }

    // return character that was scanned
    fCurrentEntity.columnNumber++;
    if (!detectingVersion) {
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
    }
    return c;

}
 
Example #6
Source File: XML11EntityScanner.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the next character on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed.
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected int scanChar(NameType nt) throws IOException {

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // scan character
    int offset = fCurrentEntity.position;
    int c = fCurrentEntity.ch[fCurrentEntity.position++];
    boolean external = false;
    if (c == '\n' ||
        ((c == '\r' || c == 0x85 || c == 0x2028) && (external = fCurrentEntity.isExternal()))) {
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)c;
            load(1, false, false);
            offset = 0;
        }
        if (c == '\r' && external) {
            int cc = fCurrentEntity.ch[fCurrentEntity.position++];
            if (cc != '\n' && cc != 0x85) {
                fCurrentEntity.position--;
            }
        }
        c = '\n';
    }

    // return character that was scanned
    fCurrentEntity.columnNumber++;
    if (!detectingVersion) {
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
    }
    return c;

}
 
Example #7
Source File: XML11EntityScanner.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the next character on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed.
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected int scanChar(NameType nt) throws IOException {

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // scan character
    int offset = fCurrentEntity.position;
    int c = fCurrentEntity.ch[fCurrentEntity.position++];
    boolean external = false;
    if (c == '\n' ||
        ((c == '\r' || c == 0x85 || c == 0x2028) && (external = fCurrentEntity.isExternal()))) {
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)c;
            load(1, false, false);
            offset = 0;
        }
        if (c == '\r' && external) {
            int cc = fCurrentEntity.ch[fCurrentEntity.position++];
            if (cc != '\n' && cc != 0x85) {
                fCurrentEntity.position--;
            }
        }
        c = '\n';
    }

    // return character that was scanned
    fCurrentEntity.columnNumber++;
    if (!detectingVersion) {
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
    }
    return c;

}
 
Example #8
Source File: XMLEntityScanner.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * If the current entity is an Entity reference, check the accumulated size
 * against the limit.
 *
 * @param nt type of name (element, attribute or entity)
 * @param entity The current entity
 * @param offset The index of the first byte
 * @param length The length of the entity scanned
 */
protected void checkEntityLimit(NameType nt, ScannedEntity entity, int offset, int length) {
    if (entity == null || !entity.isGE) {
        return;
    }

    if (nt != NameType.REFERENCE) {
        checkLimit(Limit.GENERAL_ENTITY_SIZE_LIMIT, entity, offset, length);
    }
    if (nt == NameType.ELEMENTSTART || nt == NameType.ATTRIBUTENAME) {
        checkNodeCount(entity);
    }
}
 
Example #9
Source File: XML11EntityScanner.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Returns the next character on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed.
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected int scanChar(NameType nt) throws IOException {

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // scan character
    int offset = fCurrentEntity.position;
    int c = fCurrentEntity.ch[fCurrentEntity.position++];
    boolean external = false;
    if (c == '\n' ||
        ((c == '\r' || c == 0x85 || c == 0x2028) && (external = fCurrentEntity.isExternal()))) {
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)c;
            load(1, false, false);
            offset = 0;
        }
        if (c == '\r' && external) {
            int cc = fCurrentEntity.ch[fCurrentEntity.position++];
            if (cc != '\n' && cc != 0x85) {
                fCurrentEntity.position--;
            }
        }
        c = '\n';
    }

    // return character that was scanned
    fCurrentEntity.columnNumber++;
    if (!detectingVersion) {
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
    }
    return c;

}
 
Example #10
Source File: XMLEntityScanner.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the current entity is an Entity reference, check the accumulated size
 * against the limit.
 *
 * @param nt type of name (element, attribute or entity)
 * @param entity The current entity
 * @param offset The index of the first byte
 * @param length The length of the entity scanned
 */
protected void checkEntityLimit(NameType nt, ScannedEntity entity, int offset, int length) {
    if (entity == null || !entity.isGE) {
        return;
    }

    if (nt != NameType.REFERENCE) {
        checkLimit(Limit.GENERAL_ENTITY_SIZE_LIMIT, entity, offset, length);
    }
    if (nt == NameType.ELEMENTSTART || nt == NameType.ATTRIBUTENAME) {
        checkNodeCount(entity);
    }
}
 
Example #11
Source File: XML11EntityScanner.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the next character on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed.
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected int scanChar(NameType nt) throws IOException {

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // scan character
    int offset = fCurrentEntity.position;
    int c = fCurrentEntity.ch[fCurrentEntity.position++];
    boolean external = false;
    if (c == '\n' ||
        ((c == '\r' || c == 0x85 || c == 0x2028) && (external = fCurrentEntity.isExternal()))) {
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)c;
            load(1, false, false);
            offset = 0;
        }
        if (c == '\r' && external) {
            int cc = fCurrentEntity.ch[fCurrentEntity.position++];
            if (cc != '\n' && cc != 0x85) {
                fCurrentEntity.position--;
            }
        }
        c = '\n';
    }

    // return character that was scanned
    fCurrentEntity.columnNumber++;
    if (!detectingVersion) {
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
    }
    return c;

}
 
Example #12
Source File: XML11EntityScanner.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the next character on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed.
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected int scanChar(NameType nt) throws IOException {

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // scan character
    int offset = fCurrentEntity.position;
    int c = fCurrentEntity.ch[fCurrentEntity.position++];
    boolean external = false;
    if (c == '\n' ||
        ((c == '\r' || c == 0x85 || c == 0x2028) && (external = fCurrentEntity.isExternal()))) {
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)c;
            load(1, false, false);
            offset = 0;
        }
        if (c == '\r' && external) {
            int cc = fCurrentEntity.ch[fCurrentEntity.position++];
            if (cc != '\n' && cc != 0x85) {
                fCurrentEntity.position--;
            }
        }
        c = '\n';
    }

    // return character that was scanned
    fCurrentEntity.columnNumber++;
    if (!detectingVersion) {
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
    }
    return c;

}
 
Example #13
Source File: XMLEntityScanner.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * If the current entity is an Entity reference, check the accumulated size
 * against the limit.
 *
 * @param nt type of name (element, attribute or entity)
 * @param entity The current entity
 * @param offset The index of the first byte
 * @param length The length of the entity scanned
 */
protected void checkEntityLimit(NameType nt, ScannedEntity entity, int offset, int length) {
    if (entity == null || !entity.isGE) {
        return;
    }

    if (nt != NameType.REFERENCE) {
        checkLimit(Limit.GENERAL_ENTITY_SIZE_LIMIT, entity, offset, length);
    }
    if (nt == NameType.ELEMENTSTART || nt == NameType.ATTRIBUTENAME) {
        checkNodeCount(entity);
    }
}
 
Example #14
Source File: XMLEntityScanner.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the current entity is an Entity reference, check the accumulated size
 * against the limit.
 *
 * @param nt type of name (element, attribute or entity)
 * @param entity The current entity
 * @param offset The index of the first byte
 * @param length The length of the entity scanned
 */
protected void checkEntityLimit(NameType nt, ScannedEntity entity, int offset, int length) {
    if (entity == null || !entity.isGE) {
        return;
    }

    if (nt != NameType.REFERENCE) {
        checkLimit(Limit.GENERAL_ENTITY_SIZE_LIMIT, entity, offset, length);
    }
    if (nt == NameType.ELEMENTSTART || nt == NameType.ATTRIBUTENAME) {
        checkNodeCount(entity);
    }
}
 
Example #15
Source File: XMLEntityScanner.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Skips a character appearing immediately on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed only if it matches
 * the specified character.
 *
 * @param c The character to skip.
 * @param nt The type of the name (element or attribute)
 *
 * @return Returns true if the character was skipped.
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected boolean skipChar(int c, NameType nt) throws IOException {
    if (DEBUG_BUFFER) {
        System.out.print("(skipChar, '"+(char)c+"': ");
        print();
        System.out.println();
    }

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // skip character
    int offset = fCurrentEntity.position;
    int cc = fCurrentEntity.ch[fCurrentEntity.position];
    if (cc == c) {
        fCurrentEntity.position++;
        if (c == '\n') {
            fCurrentEntity.lineNumber++;
            fCurrentEntity.columnNumber = 1;
        } else {
            fCurrentEntity.columnNumber++;
        }
        if (DEBUG_BUFFER) {
            System.out.print(")skipChar, '"+(char)c+"': ");
            print();
            System.out.println(" -> true");
        }
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    } else if (c == '\n' && cc == '\r' && isExternal) {
        // handle newlines
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)cc;
            load(1, false, false);
        }
        fCurrentEntity.position++;
        if (fCurrentEntity.ch[fCurrentEntity.position] == '\n') {
            fCurrentEntity.position++;
        }
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        if (DEBUG_BUFFER) {
            System.out.print(")skipChar, '"+(char)c+"': ");
            print();
            System.out.println(" -> true");
        }
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }

    // character was not skipped
    if (DEBUG_BUFFER) {
        System.out.print(")skipChar, '"+(char)c+"': ");
        print();
        System.out.println(" -> false");
    }
    return false;

}
 
Example #16
Source File: XMLEntityScanner.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the next character on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed.
 *
 * @param nt The type of the name (element or attribute)
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected int scanChar(NameType nt) throws IOException {
    if (DEBUG_BUFFER) {
        System.out.print("(scanChar: ");
        print();
        System.out.println();
    }

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // scan character
    int offset = fCurrentEntity.position;
    int c = fCurrentEntity.ch[fCurrentEntity.position++];
    if (c == '\n' || (c == '\r' && isExternal)) {
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)c;
            load(1, false, false);
            offset = 0;
        }
        if (c == '\r' && isExternal) {
            if (fCurrentEntity.ch[fCurrentEntity.position++] != '\n') {
                fCurrentEntity.position--;
            }
            c = '\n';
        }
    }

    // return character that was scanned
    if (DEBUG_BUFFER) {
        System.out.print(")scanChar: ");
        print();
        System.out.println(" -> '"+(char)c+"'");
    }
    fCurrentEntity.columnNumber++;
    if (!detectingVersion) {
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
    }
    return c;

}
 
Example #17
Source File: XMLEntityScanner.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Returns the next character on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed.
 *
 * @param nt The type of the name (element or attribute)
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected int scanChar(NameType nt) throws IOException {
    if (DEBUG_BUFFER) {
        System.out.print("(scanChar: ");
        print();
        System.out.println();
    }

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // scan character
    int offset = fCurrentEntity.position;
    int c = fCurrentEntity.ch[fCurrentEntity.position++];
    if (c == '\n' || (c == '\r' && isExternal)) {
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)c;
            load(1, false, false);
            offset = 0;
        }
        if (c == '\r' && isExternal) {
            if (fCurrentEntity.ch[fCurrentEntity.position++] != '\n') {
                fCurrentEntity.position--;
            }
            c = '\n';
        }
    }

    // return character that was scanned
    if (DEBUG_BUFFER) {
        System.out.print(")scanChar: ");
        print();
        System.out.println(" -> '"+(char)c+"'");
    }
    fCurrentEntity.columnNumber++;
    if (!detectingVersion) {
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
    }
    return c;

}
 
Example #18
Source File: XML11EntityScanner.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Skips a character appearing immediately on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed only if it matches
 * the specified character.
 *
 * @param c The character to skip.
 *
 * @return Returns true if the character was skipped.
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected boolean skipChar(int c, NameType nt) throws IOException {

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // skip character
    int offset = fCurrentEntity.position;
    int cc = fCurrentEntity.ch[fCurrentEntity.position];
    if (cc == c) {
        fCurrentEntity.position++;
        if (c == '\n') {
            fCurrentEntity.lineNumber++;
            fCurrentEntity.columnNumber = 1;
        }
        else {
            fCurrentEntity.columnNumber++;
        }
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }
    else if (c == '\n' && ((cc == 0x2028 || cc == 0x85) && fCurrentEntity.isExternal())) {
        fCurrentEntity.position++;
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }
    else if (c == '\n' && (cc == '\r' ) && fCurrentEntity.isExternal()) {
        // handle newlines
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)cc;
            load(1, false, false);
        }
        int ccc = fCurrentEntity.ch[++fCurrentEntity.position];
        if (ccc == '\n' || ccc == 0x85) {
            fCurrentEntity.position++;
        }
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }

    // character was not skipped
    return false;

}
 
Example #19
Source File: XML11EntityScanner.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Skips a character appearing immediately on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed only if it matches
 * the specified character.
 *
 * @param c The character to skip.
 *
 * @return Returns true if the character was skipped.
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected boolean skipChar(int c, NameType nt) throws IOException {

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // skip character
    int offset = fCurrentEntity.position;
    int cc = fCurrentEntity.ch[fCurrentEntity.position];
    if (cc == c) {
        fCurrentEntity.position++;
        if (c == '\n') {
            fCurrentEntity.lineNumber++;
            fCurrentEntity.columnNumber = 1;
        }
        else {
            fCurrentEntity.columnNumber++;
        }
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }
    else if (c == '\n' && ((cc == 0x2028 || cc == 0x85) && fCurrentEntity.isExternal())) {
        fCurrentEntity.position++;
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }
    else if (c == '\n' && (cc == '\r' ) && fCurrentEntity.isExternal()) {
        // handle newlines
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)cc;
            load(1, false, false);
        }
        int ccc = fCurrentEntity.ch[++fCurrentEntity.position];
        if (ccc == '\n' || ccc == 0x85) {
            fCurrentEntity.position++;
        }
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }

    // character was not skipped
    return false;

}
 
Example #20
Source File: XMLEntityScanner.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the next character on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed.
 *
 * @param nt The type of the name (element or attribute)
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected int scanChar(NameType nt) throws IOException {
    if (DEBUG_BUFFER) {
        System.out.print("(scanChar: ");
        print();
        System.out.println();
    }

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // scan character
    int offset = fCurrentEntity.position;
    int c = fCurrentEntity.ch[fCurrentEntity.position++];
    if (c == '\n' || (c == '\r' && isExternal)) {
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)c;
            load(1, false, false);
            offset = 0;
        }
        if (c == '\r' && isExternal) {
            if (fCurrentEntity.ch[fCurrentEntity.position++] != '\n') {
                fCurrentEntity.position--;
            }
            c = '\n';
        }
    }

    // return character that was scanned
    if (DEBUG_BUFFER) {
        System.out.print(")scanChar: ");
        print();
        System.out.println(" -> '"+(char)c+"'");
    }
    fCurrentEntity.columnNumber++;
    if (!detectingVersion) {
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
    }
    return c;

}
 
Example #21
Source File: XMLEntityScanner.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Skips a character appearing immediately on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed only if it matches
 * the specified character.
 *
 * @param c The character to skip.
 * @param nt The type of the name (element or attribute)
 *
 * @return Returns true if the character was skipped.
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected boolean skipChar(int c, NameType nt) throws IOException {
    if (DEBUG_BUFFER) {
        System.out.print("(skipChar, '"+(char)c+"': ");
        print();
        System.out.println();
    }

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // skip character
    int offset = fCurrentEntity.position;
    int cc = fCurrentEntity.ch[fCurrentEntity.position];
    if (cc == c) {
        fCurrentEntity.position++;
        if (c == '\n') {
            fCurrentEntity.lineNumber++;
            fCurrentEntity.columnNumber = 1;
        } else {
            fCurrentEntity.columnNumber++;
        }
        if (DEBUG_BUFFER) {
            System.out.print(")skipChar, '"+(char)c+"': ");
            print();
            System.out.println(" -> true");
        }
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    } else if (c == '\n' && cc == '\r' && isExternal) {
        // handle newlines
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)cc;
            load(1, false, false);
        }
        fCurrentEntity.position++;
        if (fCurrentEntity.ch[fCurrentEntity.position] == '\n') {
            fCurrentEntity.position++;
        }
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        if (DEBUG_BUFFER) {
            System.out.print(")skipChar, '"+(char)c+"': ");
            print();
            System.out.println(" -> true");
        }
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }

    // character was not skipped
    if (DEBUG_BUFFER) {
        System.out.print(")skipChar, '"+(char)c+"': ");
        print();
        System.out.println(" -> false");
    }
    return false;

}
 
Example #22
Source File: XMLEntityScanner.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Skips a character appearing immediately on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed only if it matches
 * the specified character.
 *
 * @param c The character to skip.
 * @param nt The type of the name (element or attribute)
 *
 * @return Returns true if the character was skipped.
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected boolean skipChar(int c, NameType nt) throws IOException {
    if (DEBUG_BUFFER) {
        System.out.print("(skipChar, '"+(char)c+"': ");
        print();
        System.out.println();
    }

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // skip character
    int offset = fCurrentEntity.position;
    int cc = fCurrentEntity.ch[fCurrentEntity.position];
    if (cc == c) {
        fCurrentEntity.position++;
        if (c == '\n') {
            fCurrentEntity.lineNumber++;
            fCurrentEntity.columnNumber = 1;
        } else {
            fCurrentEntity.columnNumber++;
        }
        if (DEBUG_BUFFER) {
            System.out.print(")skipChar, '"+(char)c+"': ");
            print();
            System.out.println(" -> true");
        }
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    } else if (c == '\n' && cc == '\r' && isExternal) {
        // handle newlines
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)cc;
            load(1, false, false);
        }
        fCurrentEntity.position++;
        if (fCurrentEntity.ch[fCurrentEntity.position] == '\n') {
            fCurrentEntity.position++;
        }
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        if (DEBUG_BUFFER) {
            System.out.print(")skipChar, '"+(char)c+"': ");
            print();
            System.out.println(" -> true");
        }
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }

    // character was not skipped
    if (DEBUG_BUFFER) {
        System.out.print(")skipChar, '"+(char)c+"': ");
        print();
        System.out.println(" -> false");
    }
    return false;

}
 
Example #23
Source File: XMLEntityScanner.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the next character on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed.
 *
 * @param nt The type of the name (element or attribute)
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected int scanChar(NameType nt) throws IOException {
    if (DEBUG_BUFFER) {
        System.out.print("(scanChar: ");
        print();
        System.out.println();
    }

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // scan character
    int offset = fCurrentEntity.position;
    int c = fCurrentEntity.ch[fCurrentEntity.position++];
    if (c == '\n' || (c == '\r' && isExternal)) {
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)c;
            load(1, false, false);
            offset = 0;
        }
        if (c == '\r' && isExternal) {
            if (fCurrentEntity.ch[fCurrentEntity.position++] != '\n') {
                fCurrentEntity.position--;
            }
            c = '\n';
        }
    }

    // return character that was scanned
    if (DEBUG_BUFFER) {
        System.out.print(")scanChar: ");
        print();
        System.out.println(" -> '"+(char)c+"'");
    }
    fCurrentEntity.columnNumber++;
    if (!detectingVersion) {
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
    }
    return c;

}
 
Example #24
Source File: XML11EntityScanner.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Skips a character appearing immediately on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed only if it matches
 * the specified character.
 *
 * @param c The character to skip.
 *
 * @return Returns true if the character was skipped.
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected boolean skipChar(int c, NameType nt) throws IOException {

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // skip character
    int offset = fCurrentEntity.position;
    int cc = fCurrentEntity.ch[fCurrentEntity.position];
    if (cc == c) {
        fCurrentEntity.position++;
        if (c == '\n') {
            fCurrentEntity.lineNumber++;
            fCurrentEntity.columnNumber = 1;
        }
        else {
            fCurrentEntity.columnNumber++;
        }
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }
    else if (c == '\n' && ((cc == 0x2028 || cc == 0x85) && fCurrentEntity.isExternal())) {
        fCurrentEntity.position++;
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }
    else if (c == '\n' && (cc == '\r' ) && fCurrentEntity.isExternal()) {
        // handle newlines
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)cc;
            load(1, false, false);
        }
        int ccc = fCurrentEntity.ch[++fCurrentEntity.position];
        if (ccc == '\n' || ccc == 0x85) {
            fCurrentEntity.position++;
        }
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }

    // character was not skipped
    return false;

}
 
Example #25
Source File: XMLEntityScanner.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Skips a character appearing immediately on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed only if it matches
 * the specified character.
 *
 * @param c The character to skip.
 * @param nt The type of the name (element or attribute)
 *
 * @return Returns true if the character was skipped.
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected boolean skipChar(int c, NameType nt) throws IOException {
    if (DEBUG_BUFFER) {
        System.out.print("(skipChar, '"+(char)c+"': ");
        print();
        System.out.println();
    }

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // skip character
    int offset = fCurrentEntity.position;
    int cc = fCurrentEntity.ch[fCurrentEntity.position];
    if (cc == c) {
        fCurrentEntity.position++;
        if (c == '\n') {
            fCurrentEntity.lineNumber++;
            fCurrentEntity.columnNumber = 1;
        } else {
            fCurrentEntity.columnNumber++;
        }
        if (DEBUG_BUFFER) {
            System.out.print(")skipChar, '"+(char)c+"': ");
            print();
            System.out.println(" -> true");
        }
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    } else if (c == '\n' && cc == '\r' && isExternal) {
        // handle newlines
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)cc;
            load(1, false, false);
        }
        fCurrentEntity.position++;
        if (fCurrentEntity.ch[fCurrentEntity.position] == '\n') {
            fCurrentEntity.position++;
        }
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        if (DEBUG_BUFFER) {
            System.out.print(")skipChar, '"+(char)c+"': ");
            print();
            System.out.println(" -> true");
        }
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }

    // character was not skipped
    if (DEBUG_BUFFER) {
        System.out.print(")skipChar, '"+(char)c+"': ");
        print();
        System.out.println(" -> false");
    }
    return false;

}
 
Example #26
Source File: XML11EntityScanner.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Skips a character appearing immediately on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed only if it matches
 * the specified character.
 *
 * @param c The character to skip.
 *
 * @return Returns true if the character was skipped.
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected boolean skipChar(int c, NameType nt) throws IOException {

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // skip character
    int offset = fCurrentEntity.position;
    int cc = fCurrentEntity.ch[fCurrentEntity.position];
    if (cc == c) {
        fCurrentEntity.position++;
        if (c == '\n') {
            fCurrentEntity.lineNumber++;
            fCurrentEntity.columnNumber = 1;
        }
        else {
            fCurrentEntity.columnNumber++;
        }
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }
    else if (c == '\n' && ((cc == 0x2028 || cc == 0x85) && fCurrentEntity.isExternal())) {
        fCurrentEntity.position++;
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }
    else if (c == '\n' && (cc == '\r' ) && fCurrentEntity.isExternal()) {
        // handle newlines
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)cc;
            load(1, false, false);
        }
        int ccc = fCurrentEntity.ch[++fCurrentEntity.position];
        if (ccc == '\n' || ccc == 0x85) {
            fCurrentEntity.position++;
        }
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }

    // character was not skipped
    return false;

}
 
Example #27
Source File: XMLEntityScanner.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Skips a character appearing immediately on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed only if it matches
 * the specified character.
 *
 * @param c The character to skip.
 * @param nt The type of the name (element or attribute)
 *
 * @return Returns true if the character was skipped.
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected boolean skipChar(int c, NameType nt) throws IOException {
    if (DEBUG_BUFFER) {
        System.out.print("(skipChar, '"+(char)c+"': ");
        print();
        System.out.println();
    }

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // skip character
    int offset = fCurrentEntity.position;
    int cc = fCurrentEntity.ch[fCurrentEntity.position];
    if (cc == c) {
        fCurrentEntity.position++;
        if (c == '\n') {
            fCurrentEntity.lineNumber++;
            fCurrentEntity.columnNumber = 1;
        } else {
            fCurrentEntity.columnNumber++;
        }
        if (DEBUG_BUFFER) {
            System.out.print(")skipChar, '"+(char)c+"': ");
            print();
            System.out.println(" -> true");
        }
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    } else if (c == '\n' && cc == '\r' && isExternal) {
        // handle newlines
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)cc;
            load(1, false, false);
        }
        fCurrentEntity.position++;
        if (fCurrentEntity.ch[fCurrentEntity.position] == '\n') {
            fCurrentEntity.position++;
        }
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        if (DEBUG_BUFFER) {
            System.out.print(")skipChar, '"+(char)c+"': ");
            print();
            System.out.println(" -> true");
        }
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }

    // character was not skipped
    if (DEBUG_BUFFER) {
        System.out.print(")skipChar, '"+(char)c+"': ");
        print();
        System.out.println(" -> false");
    }
    return false;

}
 
Example #28
Source File: XMLEntityScanner.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Returns the next character on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed.
 *
 * @param nt The type of the name (element or attribute)
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected int scanChar(NameType nt) throws IOException {
    if (DEBUG_BUFFER) {
        System.out.print("(scanChar: ");
        print();
        System.out.println();
    }

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // scan character
    int offset = fCurrentEntity.position;
    int c = fCurrentEntity.ch[fCurrentEntity.position++];
    if (c == '\n' || (c == '\r' && isExternal)) {
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)c;
            load(1, false, false);
            offset = 0;
        }
        if (c == '\r' && isExternal) {
            if (fCurrentEntity.ch[fCurrentEntity.position++] != '\n') {
                fCurrentEntity.position--;
            }
            c = '\n';
        }
    }

    // return character that was scanned
    if (DEBUG_BUFFER) {
        System.out.print(")scanChar: ");
        print();
        System.out.println(" -> '"+(char)c+"'");
    }
    fCurrentEntity.columnNumber++;
    if (!detectingVersion) {
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
    }
    return c;

}
 
Example #29
Source File: XML11EntityScanner.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Skips a character appearing immediately on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed only if it matches
 * the specified character.
 *
 * @param c The character to skip.
 *
 * @return Returns true if the character was skipped.
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected boolean skipChar(int c, NameType nt) throws IOException {

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // skip character
    int offset = fCurrentEntity.position;
    int cc = fCurrentEntity.ch[fCurrentEntity.position];
    if (cc == c) {
        fCurrentEntity.position++;
        if (c == '\n') {
            fCurrentEntity.lineNumber++;
            fCurrentEntity.columnNumber = 1;
        }
        else {
            fCurrentEntity.columnNumber++;
        }
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }
    else if (c == '\n' && ((cc == 0x2028 || cc == 0x85) && fCurrentEntity.isExternal())) {
        fCurrentEntity.position++;
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }
    else if (c == '\n' && (cc == '\r' ) && fCurrentEntity.isExternal()) {
        // handle newlines
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)cc;
            load(1, false, false);
        }
        int ccc = fCurrentEntity.ch[++fCurrentEntity.position];
        if (ccc == '\n' || ccc == 0x85) {
            fCurrentEntity.position++;
        }
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }

    // character was not skipped
    return false;

}
 
Example #30
Source File: XMLEntityScanner.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Skips a character appearing immediately on the input.
 * <p>
 * <strong>Note:</strong> The character is consumed only if it matches
 * the specified character.
 *
 * @param c The character to skip.
 * @param nt The type of the name (element or attribute)
 *
 * @return Returns true if the character was skipped.
 *
 * @throws IOException  Thrown if i/o error occurs.
 * @throws EOFException Thrown on end of file.
 */
protected boolean skipChar(int c, NameType nt) throws IOException {
    if (DEBUG_BUFFER) {
        System.out.print("(skipChar, '"+(char)c+"': ");
        print();
        System.out.println();
    }

    // load more characters, if needed
    if (fCurrentEntity.position == fCurrentEntity.count) {
        load(0, true, true);
    }

    // skip character
    int offset = fCurrentEntity.position;
    int cc = fCurrentEntity.ch[fCurrentEntity.position];
    if (cc == c) {
        fCurrentEntity.position++;
        if (c == '\n') {
            fCurrentEntity.lineNumber++;
            fCurrentEntity.columnNumber = 1;
        } else {
            fCurrentEntity.columnNumber++;
        }
        if (DEBUG_BUFFER) {
            System.out.print(")skipChar, '"+(char)c+"': ");
            print();
            System.out.println(" -> true");
        }
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    } else if (c == '\n' && cc == '\r' && isExternal) {
        // handle newlines
        if (fCurrentEntity.position == fCurrentEntity.count) {
            invokeListeners(1);
            fCurrentEntity.ch[0] = (char)cc;
            load(1, false, false);
        }
        fCurrentEntity.position++;
        if (fCurrentEntity.ch[fCurrentEntity.position] == '\n') {
            fCurrentEntity.position++;
        }
        fCurrentEntity.lineNumber++;
        fCurrentEntity.columnNumber = 1;
        if (DEBUG_BUFFER) {
            System.out.print(")skipChar, '"+(char)c+"': ");
            print();
            System.out.println(" -> true");
        }
        checkEntityLimit(nt, fCurrentEntity, offset, fCurrentEntity.position - offset);
        return true;
    }

    // character was not skipped
    if (DEBUG_BUFFER) {
        System.out.print(")skipChar, '"+(char)c+"': ");
        print();
        System.out.println(" -> false");
    }
    return false;

}