本文整理汇总了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();
}
示例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() );
}
示例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();
}
示例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);
}
}
示例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);
}
示例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);
}
}