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