|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jmlspecs.jml4.rac.CodeBuffer
public class CodeBuffer
Improved version of the StringBuffer class. This class provides
a similar feature as the StringBuffer
class. In addition,
it allows a formated strings to be appended, as implemented by
the method append(String, Object...)
.
append(String, Object...)
Constructor Summary | |
---|---|
CodeBuffer()
Creates a new code buffer. |
Method Summary | |
---|---|
CodeBuffer |
append(boolean b)
Appends the string representation of the boolean argument. |
CodeBuffer |
append(char c)
Appends the string representation of the character argument. |
CodeBuffer |
append(char[] str)
Appends the string representation of the char[] argument. |
CodeBuffer |
append(CodeBuffer cb)
Appends the given string buffer. |
CodeBuffer |
append(int i)
Appends the string representation of the int argument. |
CodeBuffer |
append(java.lang.Object o)
Appends the string representation of the object argument. |
CodeBuffer |
append(java.lang.String str)
Appends the given string. |
CodeBuffer |
append(java.lang.StringBuffer sb)
Appends the given string buffer. |
CodeBuffer |
append(java.lang.String str,
java.lang.Object... args)
Appends the given string to this buffer with format strings appearing in the string replaced with the corresponding arguments. |
static void |
main(java.lang.String[] args)
|
CodeBuffer |
tab()
Appends one tab of spaces. |
CodeBuffer |
tab(int n)
Appends given number of tab spaces. |
java.lang.String |
toString()
Returns a string contained in this code buffer. |
java.lang.StringBuffer |
toStringBuffer()
Returns a string buffer representation of this code buffer The returned string buffer is aliased o the internal one, thus changes are visible to each other. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CodeBuffer()
Method Detail |
---|
public CodeBuffer tab()
public CodeBuffer tab(int n)
public CodeBuffer append(java.lang.String str, java.lang.Object... args)
%
n, where
the number n denotes the position of the argument
to replace the format string. For example, the following two
statements have the same effect:
append("Beauti%1 %2de, %2de!", "ful", "co") append("Beautiful code, code!")If an argument is of type
char[]
, it is first
converted to a string; otherwise, a toString
method
is used to convert it to a string.
A format string with no corresponding argument remains the same. If an argument itself contains a format string, its effect is not specified; it may be or may not be replaced depending on the order of the arguments.
public CodeBuffer append(boolean b)
public CodeBuffer append(char c)
public CodeBuffer append(char[] str)
public CodeBuffer append(int i)
public CodeBuffer append(java.lang.Object o)
public CodeBuffer append(java.lang.String str)
public CodeBuffer append(java.lang.StringBuffer sb)
public CodeBuffer append(CodeBuffer cb)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.StringBuffer toStringBuffer()
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |