• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ScannedEntity类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.xml.internal.stream.Entity.ScannedEntity的典型用法代码示例。如果您正苦于以下问题:Java ScannedEntity类的具体用法?Java ScannedEntity怎么用?Java ScannedEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ScannedEntity类属于com.sun.xml.internal.stream.Entity包,在下文中一共展示了ScannedEntity类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: fixupCurrentEntity

import com.sun.xml.internal.stream.Entity.ScannedEntity; //导入依赖的package包/类
private void fixupCurrentEntity(XMLEntityManager manager,
            char [] scannedChars, int length) {
    ScannedEntity currentEntity = manager.getCurrentEntity();
    if(currentEntity.count-currentEntity.position+length > currentEntity.ch.length) {
        //resize array; this case is hard to imagine...
        char[] tempCh = currentEntity.ch;
        currentEntity.ch = new char[length+currentEntity.count-currentEntity.position+1];
        System.arraycopy(tempCh, 0, currentEntity.ch, 0, tempCh.length);
    }
    if(currentEntity.position < length) {
        // have to move sensitive stuff out of the way...
        System.arraycopy(currentEntity.ch, currentEntity.position, currentEntity.ch, length, currentEntity.count-currentEntity.position);
        currentEntity.count += length-currentEntity.position;
    } else {
        // have to reintroduce some whitespace so this parses:
        for(int i=length; i<currentEntity.position; i++)
            currentEntity.ch[i]=' ';
    }
    // prepend contents...
    System.arraycopy(scannedChars, 0, currentEntity.ch, 0, length);
    currentEntity.position = 0;
    currentEntity.baseCharOffset = 0;
    currentEntity.startPosition = 0;
    currentEntity.columnNumber = currentEntity.lineNumber = 1;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:XMLVersionDetector.java


示例2: checkLimit

import com.sun.xml.internal.stream.Entity.ScannedEntity; //导入依赖的package包/类
/**
 * Checks whether the value of the specified Limit exceeds its limit
 *
 * @param limit The Limit to be checked
 * @param entity The current entity
 * @param offset The index of the first byte
 * @param length The length of the entity scanned
 */
protected void checkLimit(Limit limit, ScannedEntity entity, int offset, int length) {
    fLimitAnalyzer.addValue(limit, entity.name, length);
    if (fSecurityManager.isOverLimit(limit, fLimitAnalyzer)) {
        fSecurityManager.debugPrint(fLimitAnalyzer);
        Object[] e = (limit == Limit.ENTITY_REPLACEMENT_LIMIT) ?
                new Object[]{fLimitAnalyzer.getValue(limit),
                    fSecurityManager.getLimit(limit), fSecurityManager.getStateLiteral(limit)} :
                new Object[]{entity.name, fLimitAnalyzer.getValue(limit),
                    fSecurityManager.getLimit(limit), fSecurityManager.getStateLiteral(limit)};
        fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, limit.key(),
                e, XMLErrorReporter.SEVERITY_FATAL_ERROR);
    }
    if (fSecurityManager.isOverLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT, fLimitAnalyzer)) {
        fSecurityManager.debugPrint(fLimitAnalyzer);
        fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "TotalEntitySizeLimit",
                new Object[]{fLimitAnalyzer.getTotalValue(Limit.TOTAL_ENTITY_SIZE_LIMIT),
            fSecurityManager.getLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT),
            fSecurityManager.getStateLiteral(Limit.TOTAL_ENTITY_SIZE_LIMIT)},
                XMLErrorReporter.SEVERITY_FATAL_ERROR);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:XMLEntityScanner.java


示例3: setCurrentEntity

import com.sun.xml.internal.stream.Entity.ScannedEntity; //导入依赖的package包/类
/** set the instance of current scanned entity.
 *   @param ScannedEntity
 */

public final void setCurrentEntity(Entity.ScannedEntity scannedEntity){
    fCurrentEntity = scannedEntity ;
    if(fCurrentEntity != null){
        isExternal = fCurrentEntity.isExternal();
        if(DEBUG_BUFFER)
            System.out.println("Current Entity is "+scannedEntity.name);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:XMLEntityScanner.java


示例4: checkBeforeLoad

import com.sun.xml.internal.stream.Entity.ScannedEntity; //导入依赖的package包/类
/**
 * Checks whether the end of the entity buffer has been reached. If yes,
 * checks against the limit and buffer size before loading more characters.
 *
 * @param entity the current entity
 * @param offset the offset from which the current read was started
 * @param nameOffset the offset from which the current name starts
 * @return the length of characters scanned before the end of the buffer,
 * zero if there is more to be read in the buffer
 */
protected int checkBeforeLoad(Entity.ScannedEntity entity, int offset,
        int nameOffset) throws IOException {
    int length = 0;
    if (++entity.position == entity.count) {
        length = entity.position - offset;
        int nameLength = length;
        if (nameOffset != -1) {
            nameOffset = nameOffset - offset;
            nameLength = length - nameOffset;
        } else {
            nameOffset = offset;
        }
        //check limit before loading more data
        checkLimit(Limit.MAX_NAME_LIMIT, entity, nameOffset, nameLength);
        invokeListeners(length);
        if (length == entity.ch.length) {
            // bad luck we have to resize our buffer
            char[] tmp = new char[entity.fBufferSize * 2];
            System.arraycopy(entity.ch, offset, tmp, 0, length);
            entity.ch = tmp;
            entity.fBufferSize *= 2;
        }
        else {
            System.arraycopy(entity.ch, offset, entity.ch, 0, length);
        }
    }
    return length;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:39,代码来源:XMLEntityScanner.java


示例5: checkEntityLimit

import com.sun.xml.internal.stream.Entity.ScannedEntity; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:XMLEntityScanner.java


示例6: checkLimit

import com.sun.xml.internal.stream.Entity.ScannedEntity; //导入依赖的package包/类
/**
 * Checks whether the value of the specified Limit exceeds its limit
 *
 * @param limit The Limit to be checked.
 * @param entity The current entity.
 * @param offset The index of the first byte
 * @param length The length of the entity scanned.
 */
protected void checkLimit(Limit limit, ScannedEntity entity, int offset, int length) {
    fLimitAnalyzer.addValue(limit, null, length);
    if (fSecurityManager.isOverLimit(limit, fLimitAnalyzer)) {
        fSecurityManager.debugPrint(fLimitAnalyzer);
        fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, limit.key(),
                new Object[]{new String(entity.ch, offset, length),
            fLimitAnalyzer.getTotalValue(limit),
            fSecurityManager.getLimit(limit),
            fSecurityManager.getStateLiteral(limit)},
                XMLErrorReporter.SEVERITY_FATAL_ERROR);
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:21,代码来源:XMLEntityScanner.java


示例7: getCurrentEntity

import com.sun.xml.internal.stream.Entity.ScannedEntity; //导入依赖的package包/类
public  Entity.ScannedEntity getCurrentEntity(){
    return fCurrentEntity ;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:XMLEntityScanner.java


示例8: checkNodeCount

import com.sun.xml.internal.stream.Entity.ScannedEntity; //导入依赖的package包/类
/**
 * If the current entity is an Entity reference, counts the total nodes in
 * the entity and checks the accumulated value against the limit.
 *
 * @param entity The current entity
 */
protected void checkNodeCount(ScannedEntity entity) {
    if (entity != null && entity.isGE) {
        checkLimit(Limit.ENTITY_REPLACEMENT_LIMIT, entity, 0, 1);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:XMLEntityScanner.java



注:本文中的com.sun.xml.internal.stream.Entity.ScannedEntity类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConfigVar类代码示例发布时间:2022-05-23
下一篇:
Java DGrammarPattern类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap