本文整理汇总了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;未经允许,请勿转载。 |
请发表评论