Example usage for java.lang StringBuffer toString

List of usage examples for java.lang StringBuffer toString

Introduction

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

Prototype

@Override
    @HotSpotIntrinsicCandidate
    public synchronized String toString() 

Source Link

Usage

From source file:Main.java

public static void main(String args[]) {
    StringBuffer buffer = new StringBuffer();

    float floatValue = 2.5f;
    buffer.insert(0, floatValue);//  w  w w .j a v a2s .co m

    System.out.println(buffer.toString());

}

From source file:Main.java

public static void main(String args[]) {
    StringBuffer buffer = new StringBuffer();

    long longValue = 10000000;
    buffer.insert(0, longValue);/*  www.  j a v  a 2  s. c  o  m*/

    System.out.println(buffer.toString());

}

From source file:Main.java

public static void main(String args[]) {
    StringBuffer buffer = new StringBuffer();

    String string = "java2s.com";
    buffer.insert(0, string);/* w  ww.j a va 2 s.  c o  m*/

    System.out.println(buffer.toString());

}

From source file:Main.java

public static void main(String args[]) {
    StringBuffer buffer = new StringBuffer();

    double doubleValue = 33.3;
    buffer.insert(0, doubleValue);/*from  w ww  .  ja  v  a  2 s .  c  o  m*/

    System.out.println(buffer.toString());

}

From source file:Main.java

public static void main(String args[]) {
    StringBuffer buffer = new StringBuffer();

    Object objectRef = "java2s.com";
    buffer.insert(0, objectRef);// w  w w  .j  a v a 2 s. c  o  m
    System.out.println(buffer.toString());

}

From source file:Main.java

public static void main(String[] argv) {
    StringBuffer sb = new StringBuffer();
    sb.append(true);//from  ww  w  .j  a  v  a 2 s  . c  om
    sb.append("java2s.com");

    sb.delete(1, 2);
    System.out.println(sb.toString());
}

From source file:Main.java

public static void main(String args[]) {
    StringBuffer buffer = new StringBuffer();

    boolean booleanValue = true;
    buffer.insert(0, booleanValue);//from   ww  w  .j a  va  2 s .c  o  m

    System.out.println(buffer.toString());

}

From source file:Main.java

public static void main(String args[]) {
    StringBuffer buffer = new StringBuffer();

    char characterValue = 'K';
    buffer.insert(0, characterValue);//www .ja  v a 2 s .c o m

    System.out.println(buffer.toString());

}

From source file:StringIOApp.java

public static void main(String args[]) throws IOException {
    StringWriter outStream = new StringWriter();
    String s = "This is a test.";
    for (int i = 0; i < s.length(); ++i)
        outStream.write(s.charAt(i));//from   w  w w. j  a  v  a 2  s.  co m
    System.out.println("outstream: " + outStream);
    System.out.println("size: " + outStream.toString().length());
    StringReader inStream;
    inStream = new StringReader(outStream.toString());
    int ch = 0;
    StringBuffer sb = new StringBuffer("");
    while ((ch = inStream.read()) != -1)
        sb.append((char) ch);
    s = sb.toString();
    System.out.println(s.length() + " characters were read");
    System.out.println("They are: " + s);
}

From source file:Main.java

public static void main(String args[]) throws IOException {
    CharArrayWriter outStream = new CharArrayWriter();
    String s = "This is a test.";
    for (int i = 0; i < s.length(); ++i)
        outStream.write(s.charAt(i));/*from   w  w  w .  ja v a2 s  . c  om*/
    System.out.println("outstream: " + outStream);
    System.out.println("size: " + outStream.size());
    CharArrayReader inStream;
    inStream = new CharArrayReader(outStream.toCharArray());
    int ch = 0;
    StringBuffer sb = new StringBuffer("");
    while ((ch = inStream.read()) != -1)
        sb.append((char) ch);
    s = sb.toString();
    System.out.println(s.length() + " characters were read");
    System.out.println("They are: " + s);
}