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


Java StrBuilder.appendSeparator方法代码示例

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


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

示例1: buildFluentPathExpression

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
private static String buildFluentPathExpression(LinkedList<ContentPathSegment<?, ?>> segments) {
    StrBuilder builder = new StrBuilder();
    ElementPathSegment elemSegment;

    for (ContentPathSegment<?, ?> segment : segments) {
        builder.appendSeparator(SdcctStringUtils.PERIOD_CHAR);
        builder.append(segment.getLocalName());

        if ((segment instanceof ElementPathSegment) && (elemSegment = ((ElementPathSegment) segment)).hasIndex()) {
            builder.append(SdcctStringUtils.L_BRACKET_CHAR);
            builder.append(elemSegment.getIndex());
            builder.append(SdcctStringUtils.R_BRACKET_CHAR);
        }
    }

    return builder.build();
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:18,代码来源:ContentPathBuilderImpl.java

示例2: generateMetricName

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
@Override
public String generateMetricName( String host, Match match ) {
	log.entry( match );
	StrBuilder result = new StrBuilder();

	for ( Chunk chunk : chunks ) {
		result.appendSeparator( '.' );
		result.append( chunk.apply( match ) );
	}
	return log.exit( result.toString() );
}
 
开发者ID:Tetha,项目名称:bifroest,代码行数:12,代码来源:Rewriter.java

示例3: computeFullyQualifiedMethodName

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
public static String computeFullyQualifiedMethodName(final String className, final String methodName, final Type[] argumentTypes) {
	StrBuilder sb = new StrBuilder(50);
	sb.append(abbreviatePackageName(className));
	sb.append('.');
	sb.append(methodName);
	sb.append('(');
	for (int i = 0; i < argumentTypes.length; ++i) {
		sb.appendSeparator(", ", i);
		sb.append(abbreviatePackageName(argumentTypes[i].getClassName()));
	}
	sb.append(')');
	return sb.toString();
}
 
开发者ID:mgm-tp,项目名称:perfload-agent,代码行数:14,代码来源:ClassNameUtils.java

示例4: appendEscapedAndQuoted

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
private void appendEscapedAndQuoted(final StrBuilder sb, final String value) {
	boolean foundLineBreak = false;

	sb.appendSeparator(delimiter);

	if (quoted) {
		sb.append(quoteChar);
	}

	if (value != null) {
		for (int i = 0, len = value.length(); i < len; ++i) {
			char c = value.charAt(i);
			switch (c) {
				case '\r':
				case '\n':
					foundLineBreak = true;
					continue;
				default:
					if (foundLineBreak) {
						sb.append(' ');
						foundLineBreak = false;
					}
					if (quoted && c == quoteChar) { // can't have this as case because it is no constant expression
						sb.append(c); // escape double quote, i. e. add quote character again
					}
					break;
			}
			sb.append(c);
		}
	}

	if (quoted) {
		sb.append(quoteChar);
	}
}
 
开发者ID:mgm-tp,项目名称:jfunk,代码行数:36,代码来源:CsvReporter.java

示例5: appendEscapedAndQuoted

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
public static void appendEscapedAndQuoted(final StrBuilder sb, final char delimiter, final String value) {
	boolean foundLineBreak = false;

	sb.appendSeparator(delimiter);

	sb.append(CSV_QUOTE);
	if (value != null) {
		for (int i = 0, len = value.length(); i < len; ++i) {
			char c = value.charAt(i);
			switch (c) {
				case CSV_QUOTE:
					if (foundLineBreak) {
						foundLineBreak = false;
						sb.append(' ');
					}
					sb.append(c); // escape double quote, i. e. add quote character again
					break;
				case '\r':
				case '\n':
					foundLineBreak = true;
					continue;
				default:
					if (foundLineBreak) {
						sb.append(' ');
						foundLineBreak = false;
					}
					break;
			}
			sb.append(c);
		}
	}
	sb.append(CSV_QUOTE);
}
 
开发者ID:mgm-tp,项目名称:perfload-perfalyzer,代码行数:34,代码来源:StrBuilderUtils.java

示例6: normalize

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
public void normalize(final File file) throws IOException {
	checkState(!file.isAbsolute(), "'file' must be relative");

	String filePath = file.getPath();
	String[] pathElements = split(getPath(filePath), SystemUtils.FILE_SEPARATOR); // strip out dir

	StrBuilder sb = new StrBuilder();
	for (int i = 0; i < pathElements.length; ++i) {
		if (i == 1) {
			continue; // strip out dir, e. g. perfmon-logs, measuring-logs
		}
		sb.appendSeparator(SystemUtils.FILE_SEPARATOR);
		sb.append(pathElements[i]);
	}
	String dirPath = sb.toString();

	Map<String, FileChannel> channels = newHashMap();
	List<OutputStream> outputStreams = newArrayList();
	FileInputStream fis = null;
	try {
		fis = new FileInputStream(new File(sourceDir, filePath)); //relative to source dir
		for (Scanner scanner = new Scanner(fis, Charsets.UTF_8.name()); scanner.hasNext();) {
			String line = scanner.nextLine();
			if (trimToNull(line) == null || line.startsWith("#")) {
				continue;
			}
			List<ChannelData> channelDataList = normalizingStrategy.normalizeLine(line);
			for (ChannelData channelData : channelDataList) {

				FileChannel channel = channels.get(channelData.getChannelKey());
				if (channel == null) {
					String baseName = channelData.getChannelBaseName();
					String key = channelData.getChannelKey();
					String fileName = new File(dirPath, String.format("[%s][%s].csv", baseName, key)).getPath();
					File destFile = new File(destDir, fileName);
					destFile.getParentFile().mkdirs();
					FileOutputStream fos = new FileOutputStream(destFile);
					outputStreams.add(fos);
					channel = fos.getChannel();
					channels.put(channelData.getChannelKey(), channel);
				}

				writeLineToChannel(channel, channelData.getValue(), Charsets.UTF_8);
			}
		}
	} finally {
		outputStreams.forEach(IOUtils::closeQuietly);
		closeQuietly(fis);
	}
}
 
开发者ID:mgm-tp,项目名称:perfload-perfalyzer,代码行数:51,代码来源:Normalizer.java


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