当前位置: 首页>>代码示例>>Java>>正文


Java AttributedCharacterIterator.current方法代码示例

本文整理汇总了Java中java.text.AttributedCharacterIterator.current方法的典型用法代码示例。如果您正苦于以下问题:Java AttributedCharacterIterator.current方法的具体用法?Java AttributedCharacterIterator.current怎么用?Java AttributedCharacterIterator.current使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.text.AttributedCharacterIterator的用法示例。


在下文中一共展示了AttributedCharacterIterator.current方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: format

import java.text.AttributedCharacterIterator; //导入方法依赖的package包/类
@Override
String format(
        AttributedCharacterIterator iterator,
        String preExponent) {
    int copyFromOffset = 0;
    StringBuilder result = new StringBuilder();
    for (
            iterator.first();
            iterator.current() != CharacterIterator.DONE;
        ) {
        Map<Attribute, Object> attributeSet = iterator.getAttributes();
        if (attributeSet.containsKey(NumberFormat.Field.EXPONENT_SYMBOL)) {
            append(
                    iterator,
                    copyFromOffset,
                    iterator.getRunStart(NumberFormat.Field.EXPONENT_SYMBOL),
                    result);
            copyFromOffset = iterator.getRunLimit(NumberFormat.Field.EXPONENT_SYMBOL);
            iterator.setIndex(copyFromOffset);
            result.append(preExponent);
            result.append(beginMarkup);
        } else if (attributeSet.containsKey(NumberFormat.Field.EXPONENT)) {
            int limit = iterator.getRunLimit(NumberFormat.Field.EXPONENT);
            append(
                    iterator,
                    copyFromOffset,
                    limit,
                    result);
            copyFromOffset = limit;
            iterator.setIndex(copyFromOffset);
            result.append(endMarkup);
        } else {
            iterator.next();
        }
    }
    append(iterator, copyFromOffset, iterator.getEndIndex(), result);
    return result.toString();
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:39,代码来源:ScientificNumberFormatter.java

示例2: char32AtAndAdvance

import java.text.AttributedCharacterIterator; //导入方法依赖的package包/类
private static int char32AtAndAdvance(AttributedCharacterIterator iterator) {
    char c1 = iterator.current();
    char c2 = iterator.next();
    if (UCharacter.isHighSurrogate(c1)) {
        // If c2 is DONE, it will fail the low surrogate test and we
        // skip this block.
        if (UCharacter.isLowSurrogate(c2)) {
            iterator.next();
            return UCharacter.toCodePoint(c1, c2);
        }
    }
    return c1;
}
 
开发者ID:abhijitvalluri,项目名称:fitnotifications,代码行数:14,代码来源:ScientificNumberFormatter.java

示例3: iterateRun

import java.text.AttributedCharacterIterator; //导入方法依赖的package包/类
private boolean iterateRun(AttributedCharacterIterator iterator, StringBuilder sb) {
	sb.setLength(0);
	int charCount = iterator.getRunLimit() - iterator.getRunStart();
	while (charCount-- >= 0) {
		char c = iterator.current();
		iterator.next();
		if (c == AttributedCharacterIterator.DONE) {
			return false;
		} else {
			sb.append(c);
		}
	}
	return true;
}
 
开发者ID:rototor,项目名称:pdfbox-graphics2d,代码行数:15,代码来源:PdfBoxGraphics2DFontTextDrawer.java


注:本文中的java.text.AttributedCharacterIterator.current方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。