View RSS Feed

Java String


Rate this Entry
by , 04-26-2012 at 07:36 PM (365 Views)
Thread safed & mutable character sequence. Basically it is just like String however modifications could be done with it. At any time, few specified character sequences are present in it but the content or length of that sequence might be changed via method calls.

Mutilple threads may use string buffers safely. Synchronization of methods is done where it is considered to be an important thing hence all operations that take place at some specific instance would behave like they take place in a serial order which is quite consistent with the method calls order, made by individual threads.

On a StringBuffer, operations append and methods are inserted that are overloaded to accept any type of data. A given datum is converted effectively into a string and then characters are inserted of that string, into string buffer. These characters are always added by the append method at the buffer’s end. Characters are added by the insert method at some specific point.

Let’s say if z is being referred to the string buffer object. “Start” is its current content. String buffer will be caused by method call z.append("le") to have “starlet”. String Buffer will be altered by z.insert(4, "le") to have “starlet”

Submit "StringBuffer" to Facebook Submit "StringBuffer" to Digg Submit "StringBuffer" to Submit "StringBuffer" to StumbleUpon Submit "StringBuffer" to Google

Tags: stringbuffer Add / Edit Tags