Example usage for java.lang StringBuffer append

List of usage examples for java.lang StringBuffer append

Introduction

In this page you can find the example usage for java.lang StringBuffer append.

Prototype

@Override
    public synchronized StringBuffer append(double d) 

Source Link

Usage

From source file:Main.java

private static String createLog(String log) {
    StringBuffer buffer = new StringBuffer();
    buffer.append(methodName);
    buffer.append("(").append(className).append(":").append(lineNumber).append(")");
    buffer.append(log);/*  w  ww . j  a v a 2s  .  co m*/
    return buffer.toString();
}

From source file:Main.java

private static String rebuildMsg(StackTraceElement stackTraceElement, String msg) {
    StringBuffer sb = new StringBuffer();
    sb.append(stackTraceElement.getFileName());
    sb.append(" (");
    sb.append(stackTraceElement.getLineNumber());
    sb.append(") ");
    sb.append(stackTraceElement.getMethodName());
    sb.append(": ");
    sb.append(msg);/*from w  ww . j  a v  a2 s.co  m*/
    return sb.toString();
}

From source file:Main.java

public static void appendHeader(StringBuffer sb, String nodeName) {
    sb.append("<");
    sb.append(nodeName);//from   ww w .j av a 2 s  .  c  o  m
    sb.append(">");
}

From source file:Main.java

public static String getHTMLFontStyle(Font font) {
    StringBuffer out = new StringBuffer();
    out.append("font-size: " + font.getSize() + "px; ");
    out.append("font-family: " + font.getSize() + "; ");
    if (font.isItalic())
        out.append("font-style: italic; ");
    if (font.isBold())
        out.append("font-weight: bold; ");
    return out.toString();
}

From source file:Main.java

/**
 * Return the very first line of an XML file.
 * Beware : the encoding used in xml is not the same as the one returned 
 * by the java Writer's getEncoding methods. writeFirstLine take care of it
 * @see EncodingMap.getXMLFromJava(String)
 *///from ww  w  .j  a  v a 2s .co m
public static String getFirstLine(String xmlEncoding) {
    StringBuffer sb = new StringBuffer(64);
    sb.append("<?xml version=\"1.0\" encoding=\"");
    sb.append(xmlEncoding);
    sb.append("\" standalone=\"yes\"?>");
    return sb.toString();
}

From source file:Main.java

public static void appendFooter(StringBuffer sb, String nodeName) {
    sb.append("</");
    sb.append(nodeName);/*w w w.  ja  v  a 2s. c o  m*/
    sb.append(">");
}

From source file:Main.java

public static void closeTag(StringBuffer sb, String name) {
    sb.append("</").append(name).append(">\n");
}

From source file:Main.java

public static String toString(Object array[]) {
    StringBuffer sb = new StringBuffer();
    sb.append("[");
    for (int i = 0; i < array.length; i++) {
        sb.append(array[i]);//  w w  w  . j av  a2  s . c  om
        if (i < array.length - 1)
            sb.append(",");
    }

    sb.append("]");
    return sb.toString();
}

From source file:Main.java

public static String getItemXml(String name, String price, String special) {
    StringBuffer buffer = new StringBuffer();
    buffer.append("<item>");
    buffer.append("<name>" + name + "</name>");
    buffer.append("<price>" + price + "</price>");
    buffer.append("<special>" + special + "</special>");
    buffer.append("</item>");

    return buffer.toString();
}

From source file:Main.java

public static String serializeCert(X509Certificate cert) throws CertificateEncodingException {
    StringBuffer buffer = new StringBuffer();
    buffer.append("-----BEGIN CERTIFICATE-----\n");
    buffer.append(Base64.encodeToString(cert.getEncoded(), Base64.DEFAULT));
    buffer.append("\n-----END CERTIFICATE-----");
    return buffer.toString();
}