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

/**
 * Configures a label as if it was an hyperlink.
 * /*from w  w w . jav a 2 s. c om*/
 * @param label
 *            the label to configure.
 */
public static void configureLabelAsHyperlink(JLabel label) {
    if (label == null) {
        return;
    }

    StringBuffer html = new StringBuffer();
    html.append("<html><font color=\"blue\"><u>");
    html.append(label.getText());
    html.append("</u></font></html>");

    label.setText(html.toString());
    label.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}

From source file:Main.java

public static String buildJsonImage(String toUser, String mediaId) {
    StringBuffer sb = new StringBuffer();
    sb.append("{");
    sb.append("\"touser\":\"").append(toUser).append("\",");
    sb.append("\"msgtype\":\"image\",");
    sb.append("\"image\":{");
    sb.append("\"media_id\":\"").append(mediaId).append("\"");
    sb.append("}}");
    return sb.toString();
}

From source file:Main.java

public static String getCustomerXml(String name) {
    StringBuffer buffer = new StringBuffer();
    buffer.append("<customer>");
    buffer.append("<name>" + name + "</name>");
    buffer.append("</customer>");

    return buffer.toString();
}

From source file:Main.java

public static String buildJsonVoice(String toUser, String mediaId) {
    StringBuffer sb = new StringBuffer();
    sb.append("{");
    sb.append("\"touser\":\"").append(toUser).append("\",");
    sb.append("\"msgtype\":\"voice\",");
    sb.append("\"voice\":{");
    sb.append("\"media_id\":\"").append(mediaId).append("\"");
    sb.append("}}");
    return sb.toString();
}

From source file:Main.java

public static String PreviewJsonMessageMASS(String openId, String mediaId) {
    StringBuffer sb = new StringBuffer();
    sb.append("{");
    sb.append("\"touser\":\"").append(openId).append("\",");
    sb.append("\"msgtype\":\"mpnews\",");
    sb.append("\"mpnews\":{");
    sb.append("\"media_id\":\"").append(mediaId).append("\"");
    sb.append("}}");
    return sb.toString();
}

From source file:Main.java

public static String buildJsonText(String toUser, String content) {
    StringBuffer sb = new StringBuffer();
    sb.append("{");
    sb.append("\"touser\":\"").append(toUser).append("\",");
    sb.append("\"msgtype\":\"text\",");
    sb.append("\"text\":{");
    sb.append("\"content\":\"").append(content).append("\"");
    sb.append("}}");
    return sb.toString();
}

From source file:Main.java

public static String getCustomerXml(String name, String uname) {
    StringBuffer buffer = new StringBuffer();
    buffer.append("<customer>");
    buffer.append("<name>" + name + "</name>");
    buffer.append("<uname>" + uname + "</uname>");
    buffer.append("</customer>");

    return buffer.toString();
}

From source file:MainClass.java

public static String toString(byte[] a) {
    StringBuffer result = new StringBuffer("[");
    for (int i = 0; i < a.length; i++) {
        result.append(a[i]);
        if (i < a.length - 1)
            result.append(", ");
    }/*  ww  w .  j av  a 2 s  . c o m*/
    result.append("]");
    return result.toString();
}

From source file:Main.java

public static String getCustomerXml(String name, String uname, String password) {
    StringBuffer buffer = new StringBuffer();
    buffer.append("<customer>");
    buffer.append("<name>" + name + "</name>");
    buffer.append("<uname>" + uname + "</uname>");
    buffer.append("<password>" + password + "</password>");
    buffer.append("</customer>");

    return buffer.toString();
}

From source file:Main.java

public static String createByeByeMessage() {

    /*/*from  ww  w . j  a va2 s .c o  m*/
    NOTIFY * HTTP/1.1
    HOST: 239.255.255.250:1900
    NTS: ssdp:byebye
    USN: uuid:0b1f697a-a0fa-5181-010f-8edcc5a1a3e8::upnp:rootdevice
    NT: upnp:rootdevice
    CONTENT-LENGTH: 0
     */
    StringBuffer sb = new StringBuffer();

    sb.append("NOTIFY * HTTP/1.1").append("\n");
    sb.append("HOST: 239.255.255.250:1900").append("\n");
    sb.append("NTS: ssdp:byebye").append("\n");
    sb.append("USN: uuid:0b1f697a-a0fa-5181-010f-8edcc5a1a3e8::upnp:rootdevice").append("\n");
    sb.append("NT: upnp:rootdevice").append("\n");
    sb.append("CONTENT-LENGTH: 0").append("\n");

    return sb.toString();
}