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


Java StrBuilder.append方法代码示例

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


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

示例1: readFileWithFileSizeBuffer

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
public static StrBuilder readFileWithFileSizeBuffer(Path file ) throws IOException
{
    FileChannel inChannel = null;
    RandomAccessFile aFile = null;
    StrBuilder builder = new StrBuilder();
    try
    {
        aFile = new RandomAccessFile( file.toString(), "r" );
        inChannel = aFile.getChannel();
        long fileSize = inChannel.size();
        ByteBuffer buffer = ByteBuffer.allocate( ( int ) fileSize );
        inChannel.read( buffer );
        buffer.flip();
        for ( int i = 0; i < fileSize; i++ )
        {
            builder.append( ( char ) buffer.get() );
        }

        return builder.trim();
    }
    finally
    {
        if( null != inChannel ) inChannel.close();
        if( null != aFile ) aFile.close();
    }
}
 
开发者ID:hemano,项目名称:cucumber-framework-java,代码行数:27,代码来源:FileUtils.java

示例2: getItemString

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
@Override
public <LI extends AsciiListItem> StrBuilder getItemString(LI item, int index) {
	StrBuilder ret = new StrBuilder(20);
	ret
		.appendPadding(this.getItemMargin(), this.getItemChar())
		.append(this.getLeftLabelString())
		.appendPadding(this.getLabelLeftMargin(), this.getLabelLeftChar())
	;

	if(item instanceof DescriptionListItem){
		ret.append(((DescriptionListItem) item).getKey());
	}

	ret
		.appendPadding(this.getLabelRightMargin(), this.getLabelRightChar())
		.append(this.getRightLabelString())
	;

	if(item instanceof DescriptionListItem){
		ret.appendPadding(this.getTextLeftMargin(), this.getTextLeftChar());
	}

	return ret;
}
 
开发者ID:vdmeer,项目名称:asciilist,代码行数:25,代码来源:DescriptionListContext.java

示例3: getItemString

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
@Override
public <LI extends AsciiListItem> StrBuilder getItemString(LI item, int index) {
	StrBuilder ret = new StrBuilder(20);
	ret
		.appendPadding(this.getItemMargin(), this.getItemChar())
		.append(this.getLeftLabelString())
		.appendPadding(this.getLabelLeftMargin(), this.getLabelLeftChar())
	;

	if(item instanceof ChecklistItem){
		ret.append(this.getStyle().getLabel(this.getLevel(), ((ChecklistItem) item).isChecked()));
	}
	else{
		ret.append(this.getStyle().getLabel(this.getLevel(), false));
	}

	ret.appendPadding(this.getLabelRightMargin(), this.getLabelRightChar())
		.append(this.getRightLabelString())
		.appendPadding(this.getTextLeftMargin(), this.getTextLeftChar())
	;
	return ret;
}
 
开发者ID:vdmeer,项目名称:asciilist,代码行数:23,代码来源:ChecklistContext.java

示例4: 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

示例5: buildJsonPointerExpression

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

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

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

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

示例6: buildSafeFileName

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
public static String buildSafeFileName(String fileName) {
    char[] fileNameChars = FilenameUtils.getName(fileName).toCharArray();
    StrBuilder fileNameBuilder = new StrBuilder(fileNameChars.length);
    char fileNameChar;

    for (int a = 0; a < fileNameChars.length; a++) {
        if (!CharUtils.isAscii((fileNameChar = fileNameChars[a]))) {
            continue;
        }

        if (Character.isWhitespace(fileNameChar)) {
            while (((a + 1) < fileNameChars.length) && Character.isWhitespace(fileNameChars[(a + 1)])) {
                a++;
            }

            if (!fileNameBuilder.isEmpty() && ((a + 2) < fileNameChars.length)) {
                fileNameBuilder.append(StringUtils.SPACE);
            }
        } else if (Character.isLetterOrDigit(fileNameChar) || (fileNameChar == CrigttStringUtils.HYPHEN_CHAR)
            || (fileNameChar == CrigttStringUtils.PERIOD_CHAR) || (fileNameChar == CrigttStringUtils.UNDERSCORE_CHAR)) {
            fileNameBuilder.append(fileNameChar);
        }
    }

    return fileNameBuilder.build();
}
 
开发者ID:esacinc,项目名称:crigtt,代码行数:27,代码来源:CrigttFileUtils.java

示例7: toString

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
@Override
public String toString() {

    StrBuilder sb = new StrBuilder();
    sb.setNewLineText("\n");
    sb.appendNewLine();
    sb.append("&6Clone Min Location: &b").append(min).appendNewLine();
    sb.append("&6Clone Max Location: &b").append(max).appendNewLine();
    sb.append("&aClone to Location: &5").append(cloneTo).appendNewLine();
    sb.appendNewLine();
    sb.append("&6Mask: ");
    if (mask.isEmpty())
        sb.append("&bNot Set");
    else
        sb.append("&b").append(mask);
    sb.appendNewLine();
    sb.append("&6Mode: ");
    if (mode.isEmpty())
        sb.append("&bNot Set");
    else
        sb.append("&b").append(mode);
    sb.appendNewLine();

    return TextProcessor.stripColor(sb.toString());
}
 
开发者ID:Relicum,项目名称:Ipsum,代码行数:26,代码来源:Region.java

示例8: generateHeaders

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
/**
 * Outputs table headers.
 *
 * <p>
 * <b>WARNING</b> : this method accepts HTML content as table headers. Any
 * sensitive value must be encoded before calling this method.
 *
 * @param sb
 *            The target string builder.
 * @param cols
 *            Column titles (HTML).
 */
public static void generateHeaders(StrBuilder sb, Object... cols) {
	sb.append("<thead><tr>");
	for (Object obj : cols) {
		sb.append("<th>");
		if (obj != null) {

			if (obj instanceof Long) {
				sb.append(((Long) obj).longValue());
			} else {
				sb.append(obj.toString());
			}
		}
		sb.append("</th>");
	}
	sb.append("</tr></thead><tbody>");
}
 
开发者ID:appstatus,项目名称:appstatus,代码行数:29,代码来源:HtmlUtils.java

示例9: generateRow

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
/**
 * Outputs one table row.
 * <p>
 * <b>WARNING</b> : this method accepts HTML content as row content. Any
 * sensitive value must be encoded before calling this method.
 *
 *
 * @param sb
 *            The target string builder.
 * @param status
 *            status class name.
 * @param cols
 *            Column titles (HTML).
 * @throws IOException
 */
public static void generateRow(StrBuilder sb, String status, Object... cols) throws IOException {
	sb.append("<tr>");

	sb.append(("<td class='icon'><img src='?icon=" + escapeHtml4(status) + "'></td>"));

	for (Object obj : cols) {
		sb.append("<td>");
		if (obj != null) {

			if (obj instanceof Date) {
				DateFormat dateFormat = getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM);
				sb.append(dateFormat.format((Date) obj));
			} else {
				sb.append(obj.toString());
			}
		}
		sb.append("</td>");

	}
	sb.append("</tr>");
}
 
开发者ID:appstatus,项目名称:appstatus,代码行数:37,代码来源:HtmlUtils.java

示例10: createExpectedResultString

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
private String createExpectedResultString(final String errorMsg, final Object... extras) {
	String success = errorMsg != null ? "ERROR" : "SUCCESS";

	StrBuilder sb = new StrBuilder(250);
	sb.setNullText("");

	String result = String.format(EXP_RESULT_TEMPLATE, timestamp, success, trimToEmpty(errorMsg), localhost, executionId,
			requestId);
	sb.append(result);
	if (extras != null) {
		for (Object extra : extras) {
			sb.append(";\"");
			sb.append(extra);
			sb.append("\"");
		}
	}
	return sb.toString();
}
 
开发者ID:mgm-tp,项目名称:perfload-logging,代码行数:19,代码来源:DefaultResultLoggerTest.java

示例11: dumpTrie

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
public String dumpTrie(boolean compact) {
    if (root == null) return "<empty>";
    encode();
    StrBuilder ret = new StrBuilder();
    List<String> strings = root.dumpTrieNode(compact);
    ret.append("Root: " + hash2str(getRootHash(), compact) + "\n");
    for (String s : strings) {
        ret.append(s).append('\n');
    }
    return ret.toString();
}
 
开发者ID:talentchain,项目名称:talchain,代码行数:12,代码来源:TrieImpl.java

示例12: getHeader

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
private String getHeader() {
	TMemberService tMemberService = SingletonS2Container.getComponent(TMemberService.class);
	if (sendMemberID != null) {
		TMember tMember = tMemberService.findById(sendMemberID);
		StrBuilder builder = new StrBuilder();
		builder.append("\"");
		builder.append(tMember.hname);
		builder.append("\"");
		builder.append("さんより");
		builder.append("\n");
		builder.append("\n");
		return builder.toString();
	}
	return null;
}
 
开发者ID:kagucho,项目名称:tsubonesystem2,代码行数:16,代码来源:MailManager.java

示例13: getFooder

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
private String getFooder() {
	StrBuilder builder = new StrBuilder();
	builder.append("\n");
	builder.append("////////////////////////////////\n");
	builder.append("神楽坂一丁目通信局");
	builder.append("\n");
	builder.append(ConfigUtil.getConfig("web.uri") + "login/");
	builder.append("\n");
	builder.append("\n");
	return builder.toString();
}
 
开发者ID:kagucho,项目名称:tsubonesystem2,代码行数:12,代码来源:MailManager.java

示例14: setValidationError

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
private void setValidationError(CSVValidationResultRuntimeException e, int i) {
		StrBuilder errorMsg = new StrBuilder();
		errorMsg.append(i + "行目のデータ構造が間違っています。");
		//何故かエラーになるのでコメントアウト
//		CSVValidateResult result = e.getValidateResult();
//		for (CSVMsg msg : result.getMsgs()) {
//			errorMsg.append("\n" + msg.toString());
//		}
		setError(errorMsg.toString());
	}
 
开发者ID:kagucho,项目名称:tsubonesystem2,代码行数:11,代码来源:MemberUploadAction.java

示例15: toString

import org.apache.commons.lang3.text.StrBuilder; //导入方法依赖的package包/类
@Override
public String toString() {
	StrBuilder string = new StrBuilder();
	string.append("hname:");
	string.append(hname);
	string.append("    mail:");
	string.append(mail);
	string.append("    userName:");
	string.append(userName);
	string.append("    pw:");
	string.append(password);
	return string.toString();
}
 
开发者ID:kagucho,项目名称:tsubonesystem2,代码行数:14,代码来源:MemberUploadCsv.java


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