Java Doc for StringBuilder.java in  » Apache-Harmony-Java-SE » java-package » java » lang » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » java package » java.lang 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.lang.AbstractStringBuilder
      java.lang.StringBuilder

StringBuilder
final public class StringBuilder extends AbstractStringBuilder implements Appendable,CharSequence,Serializable(Code)

A modifiable CharSequence sequence of characters for use in creating and modifying Strings. This class is intended as a direct replacement of java.lang.StringBuffer for non-concurrent use; unlike StringBuffer this class is not synchronized for thread safety.

The majority of the modification methods on this class return StringBuilder, so that, like StringBuffers, they can be used in chaining method calls together. For example, new StringBuilder("One should ").append("always strive ").append("to achieve Harmony").


See Also:   java.lang.CharSequence
See Also:   java.lang.Appendable
See Also:   java.lang.StringBuffer
See Also:   java.lang.String
since:
   1.5



Constructor Summary
public  StringBuilder()
    

Constructs an instance with an initial capacity of 16.

public  StringBuilder(int capacity)
    

Constructs an instance with a specified capacity.

public  StringBuilder(CharSequence seq)
    

Constructs an instance that's populated by a CharSequence .

public  StringBuilder(String str)
    

Constructs an instance that's populated by a String .


Method Summary
public  StringBuilderappend(boolean b)
    

Appends the String representation of the boolean value passed.

public  StringBuilderappend(char c)
    

Appends the String representation of the char value passed.

public  StringBuilderappend(int i)
    

Appends the String representation of the int value passed. The int value is converted to a String according to the rule defined by String.valueOf(int) .


Parameters:
  i - The int value to append to this object.
public  StringBuilderappend(long lng)
    

Appends the String representation of the long value passed.

public  StringBuilderappend(float f)
    

Appends the String representation of the float value passed.

public  StringBuilderappend(double d)
    

Appends the String representation of the double value passed.

public  StringBuilderappend(Object obj)
    

Appends the String representation of the Object value passed.

public  StringBuilderappend(String str)
    

Appends the contents of the String.

public  StringBuilderappend(StringBuffer sb)
    

Appends the contents of the StringBuffer.

public  StringBuilderappend(char[] ch)
    

Appends the String representation of the char[] value passed.

public  StringBuilderappend(char[] str, int offset, int len)
    

Appends the String representation of the subset of the char[] value passed.

public  StringBuilderappend(CharSequence csq)
    

Appends the String representation of the CharSequence value passed.

public  StringBuilderappend(CharSequence csq, int start, int end)
    

Appends the String representation of the subsequence of the CharSequence value passed.

public  StringBuilderappendCodePoint(int codePoint)
    

Appends the encoded Unicode code point to this object.

public  StringBuilderdelete(int start, int end)
    

Deletes a sequence of characters within this object, shifts any remaining characters to the left and adjusts the StringBuilder.length() of this object.


Parameters:
  start - The inclusive start index to begin deletion.
Parameters:
  end - The exclusive end index to stop deletion.
public  StringBuilderdeleteCharAt(int index)
    

Deletes a single character within this object, shifts any remaining characters to the left and adjusts the StringBuilder.length() of this object.


Parameters:
  index - The index of the character to delete.
public  StringBuilderinsert(int offset, boolean b)
    

Inserts the String representation of the boolean value passed into this object at the offset passed.

public  StringBuilderinsert(int offset, char c)
    

Inserts the String representation of the char value passed into this object at the offset passed.

public  StringBuilderinsert(int offset, int i)
    

Inserts the String representation of the int value passed into this object at the offset passed.

public  StringBuilderinsert(int offset, long l)
    

Inserts the String representation of the long value passed into this object at the offset passed.

public  StringBuilderinsert(int offset, float f)
    

Inserts the String representation of the float value passed into this object at the offset passed.

public  StringBuilderinsert(int offset, double d)
    

Inserts the String representation of the double value passed into this object at the offset passed.

public  StringBuilderinsert(int offset, Object obj)
    

Inserts the String representation of the Object value passed into this object at the offset passed.

public  StringBuilderinsert(int offset, String str)
    

Inserts the String value passed into this object at the offset passed.

public  StringBuilderinsert(int offset, char[] ch)
    

Inserts the String representation of the char[] value passed into this object at the offset passed.

public  StringBuilderinsert(int offset, char[] str, int strOffset, int strLen)
    

Inserts the String representation of the subsequence of the char[] value passed into this object at the offset passed.

public  StringBuilderinsert(int offset, CharSequence s)
    

Inserts the String representation of the CharSequence value passed into this object at the offset passed.

public  StringBuilderinsert(int offset, CharSequence s, int start, int end)
    

Inserts the String representation of the subsequence of the CharSequence value passed into this object at the offset passed.

public  StringBuilderreplace(int start, int end, String str)
    

Replaces the indicated subsequence of this object with the String passed. If the String passed is longer or shorter than the subsequence, then this object will be adjusted appropriately.


Parameters:
  start - The inclusive start index of the sequence to replace in thisobject.
Parameters:
  end - The exclusive end index of the sequence to replace in thisobject.
Parameters:
  str - The String to replace the subsequence.
public  StringBuilderreverse()
    

Reverses the contents of this object.

public  StringtoString()
     Answers the contents of this StringBuilder.


Constructor Detail
StringBuilder
public StringBuilder()(Code)

Constructs an instance with an initial capacity of 16.


See Also:   StringBuilder.capacity()



StringBuilder
public StringBuilder(int capacity)(Code)

Constructs an instance with a specified capacity.


Parameters:
  capacity - The initial capacity to use.
throws:
  NegativeArraySizeException - if the capacityparameter is null.
See Also:   StringBuilder.capacity()



StringBuilder
public StringBuilder(CharSequence seq)(Code)

Constructs an instance that's populated by a CharSequence . The capacity of the new builder will bee the length of the CharSequence plus 16.


Parameters:
  seq - The CharSequence to copy into the builder.
throws:
  NullPointerException - if the seq parameter isnull.



StringBuilder
public StringBuilder(String str)(Code)

Constructs an instance that's populated by a String . The capacity of the new builder will bee the length of the String plus 16.


Parameters:
  str - The String to copy into the builder.
throws:
  NullPointerException - if the str parameter isnull.




Method Detail
append
public StringBuilder append(boolean b)(Code)

Appends the String representation of the boolean value passed. The boolean value is converted to a String according to the rule defined by String.valueOf(boolean) .


Parameters:
  b - The boolean value to append to this object. A reference to this object.
See Also:   String.valueOf(boolean)



append
public StringBuilder append(char c)(Code)

Appends the String representation of the char value passed. The char value is converted to a String according to the rule defined by String.valueOf(char) .


Parameters:
  c - The char value to append to this object. A reference to this object.
See Also:   String.valueOf(char)



append
public StringBuilder append(int i)(Code)

Appends the String representation of the int value passed. The int value is converted to a String according to the rule defined by String.valueOf(int) .


Parameters:
  i - The int value to append to this object. A reference to this object.
See Also:   String.valueOf(int)



append
public StringBuilder append(long lng)(Code)

Appends the String representation of the long value passed. The long value is converted to a String according to the rule defined by String.valueOf(long) .


Parameters:
  lng - The long value to append to this object. A reference to this object.
See Also:   String.valueOf(long)



append
public StringBuilder append(float f)(Code)

Appends the String representation of the float value passed. The float value is converted to a String according to the rule defined by String.valueOf(float) .


Parameters:
  f - The float value to append to this object. A reference to this object.
See Also:   String.valueOf(float)



append
public StringBuilder append(double d)(Code)

Appends the String representation of the double value passed. The double value is converted to a String according to the rule defined by String.valueOf(double) .


Parameters:
  d - The double value to append to this object. A reference to this object.
See Also:   String.valueOf(double)



append
public StringBuilder append(Object obj)(Code)

Appends the String representation of the Object value passed. The Object value is converted to a String according to the rule defined by String.valueOf(Object) .


Parameters:
  obj - The Object value to append to this object. A reference to this object.
See Also:   String.valueOf(Object)



append
public StringBuilder append(String str)(Code)

Appends the contents of the String. If the String passed is null, then the String "null" is appended.


Parameters:
  str - The String to append to this object. A reference to this object.



append
public StringBuilder append(StringBuffer sb)(Code)

Appends the contents of the StringBuffer. If the StringBuffer passed is null, then the StringBuffer "null" is appended.


Parameters:
  sb - The StringBuffer to append to this object. A reference to this object.



append
public StringBuilder append(char[] ch)(Code)

Appends the String representation of the char[] value passed. The char[] value is converted to a String according to the rule defined by String.valueOf(char[]) .


Parameters:
  ch - The char[] value to append to this object. A reference to this object.
See Also:   String.valueOf(char[])



append
public StringBuilder append(char[] str, int offset, int len)(Code)

Appends the String representation of the subset of the char[] value passed. The char[] value is converted to a String according to the rule defined by String.valueOf(char[]intint) .


Parameters:
  str - The char[] value to append to this object.
Parameters:
  offset - The inclusive offset index to begin copying from thestr parameter.
Parameters:
  len - The number of character to copy from the strparameter. A reference to this object.
See Also:   String.valueOf(char[]intint)



append
public StringBuilder append(CharSequence csq)(Code)

Appends the String representation of the CharSequence value passed. If the CharSequence is null, then the String "null" is appended.


Parameters:
  csq - The CharSequence value to append to thisobject. A reference to this object.



append
public StringBuilder append(CharSequence csq, int start, int end)(Code)

Appends the String representation of the subsequence of the CharSequence value passed. If the CharSequence is null, then the String "null" is used to extract the subsequence from.


Parameters:
  csq - The CharSequence value to append to thisobject.
Parameters:
  start - The beginning index of the subsequence.
Parameters:
  end - The ending index of the subsequence. A reference to this object.



appendCodePoint
public StringBuilder appendCodePoint(int codePoint)(Code)

Appends the encoded Unicode code point to this object. The code point is converted to a char[] as defined by Character.toChars(int) .


Parameters:
  codePoint - The Unicode code point to encode and append. A reference to this object.
See Also:   Character.toChars(int)



delete
public StringBuilder delete(int start, int end)(Code)

Deletes a sequence of characters within this object, shifts any remaining characters to the left and adjusts the StringBuilder.length() of this object.


Parameters:
  start - The inclusive start index to begin deletion.
Parameters:
  end - The exclusive end index to stop deletion. A reference to this object.
throws:
  StringIndexOutOfBoundsException - if start is lessthan zero, greater than the current length or greater thanend.



deleteCharAt
public StringBuilder deleteCharAt(int index)(Code)

Deletes a single character within this object, shifts any remaining characters to the left and adjusts the StringBuilder.length() of this object.


Parameters:
  index - The index of the character to delete. A reference to this object.
throws:
  StringIndexOutOfBoundsException - if index is lessthan zero or is greater than or equal to the current length.



insert
public StringBuilder insert(int offset, boolean b)(Code)

Inserts the String representation of the boolean value passed into this object at the offset passed. The boolean value is converted to a String according to the rule defined by String.valueOf(boolean) .


Parameters:
  offset - The index of this object to insert the value.
Parameters:
  b - The boolean value to insert into this object. A reference to this object.
throws:
  StringIndexOutOfBoundsException - if offset isnegative or greater than the current StringBuilder.length().
See Also:   String.valueOf(boolean)



insert
public StringBuilder insert(int offset, char c)(Code)

Inserts the String representation of the char value passed into this object at the offset passed. The char value is converted to a String according to the rule defined by String.valueOf(char) .


Parameters:
  offset - The index of this object to insert the value.
Parameters:
  c - The char value to insert into this object. A reference to this object.
throws:
  ArrayIndexOutOfBoundsException - if offset isnegative or greater than the current StringBuilder.length().
See Also:   String.valueOf(char)



insert
public StringBuilder insert(int offset, int i)(Code)

Inserts the String representation of the int value passed into this object at the offset passed. The int value is converted to a String according to the rule defined by String.valueOf(int) .


Parameters:
  offset - The index of this object to insert the value.
Parameters:
  i - The int value to insert into this object. A reference to this object.
throws:
  StringIndexOutOfBoundsException - if offset isnegative or greater than the current StringBuilder.length().
See Also:   String.valueOf(int)



insert
public StringBuilder insert(int offset, long l)(Code)

Inserts the String representation of the long value passed into this object at the offset passed. The long value is converted to a String according to the rule defined by String.valueOf(long) .


Parameters:
  offset - The index of this object to insert the value.
Parameters:
  l - The long value to insert into this object. A reference to this object.
throws:
  StringIndexOutOfBoundsException - if offset isnegative or greater than the current StringBuilder.length().
See Also:   String.valueOf(long)



insert
public StringBuilder insert(int offset, float f)(Code)

Inserts the String representation of the float value passed into this object at the offset passed. The float value is converted to a String according to the rule defined by String.valueOf(float) .


Parameters:
  offset - The index of this object to insert the value.
Parameters:
  f - The float value to insert into this object. A reference to this object.
throws:
  StringIndexOutOfBoundsException - if offset isnegative or greater than the current StringBuilder.length().
See Also:   String.valueOf(float)



insert
public StringBuilder insert(int offset, double d)(Code)

Inserts the String representation of the double value passed into this object at the offset passed. The double value is converted to a String according to the rule defined by String.valueOf(double) .


Parameters:
  offset - The index of this object to insert the value.
Parameters:
  d - The double value to insert into this object. A reference to this object.
throws:
  StringIndexOutOfBoundsException - if offset isnegative or greater than the current StringBuilder.length().
See Also:   String.valueOf(double)



insert
public StringBuilder insert(int offset, Object obj)(Code)

Inserts the String representation of the Object value passed into this object at the offset passed. The Object value is converted to a String according to the rule defined by String.valueOf(Object) .


Parameters:
  offset - The index of this object to insert the value.
Parameters:
  obj - The Object value to insert into this object. A reference to this object.
throws:
  StringIndexOutOfBoundsException - if offset isnegative or greater than the current StringBuilder.length().
See Also:   String.valueOf(Object)



insert
public StringBuilder insert(int offset, String str)(Code)

Inserts the String value passed into this object at the offset passed. If the String parameter is null, then the String "null" is inserted.


Parameters:
  offset - The index of this object to insert the value.
Parameters:
  str - The String to insert into this object. A reference to this object.
throws:
  StringIndexOutOfBoundsException - if offset isnegative or greater than the current StringBuilder.length().



insert
public StringBuilder insert(int offset, char[] ch)(Code)

Inserts the String representation of the char[] value passed into this object at the offset passed. The char[] value is converted to a String according to the rule defined by String.valueOf(char[]) .


Parameters:
  offset - The index of this object to insert the value.
Parameters:
  ch - The char[] value to insert into this object. A reference to this object.
throws:
  StringIndexOutOfBoundsException - if offset isnegative or greater than the current StringBuilder.length().
See Also:   String.valueOf(char[])



insert
public StringBuilder insert(int offset, char[] str, int strOffset, int strLen)(Code)

Inserts the String representation of the subsequence of the char[] value passed into this object at the offset passed. The char[] value is converted to a String according to the rule defined by String.valueOf(char[]intint) .


Parameters:
  offset - The index of this object to insert the value.
Parameters:
  str - The char[] value to insert into this object.
Parameters:
  strOffset - The inclusive index of the str parameterto start copying from.
Parameters:
  strLen - The number of characters to copy from the strparameter. A reference to this object.
throws:
  StringIndexOutOfBoundsException - if offset isnegative or greater than the current StringBuilder.length().
See Also:   String.valueOf(char[]intint)



insert
public StringBuilder insert(int offset, CharSequence s)(Code)

Inserts the String representation of the CharSequence value passed into this object at the offset passed. The CharSequence value is converted to a String as defined by CharSequence.toString . If the CharSequence is null, then the String "null" is inserted.


Parameters:
  offset - The index of this object to insert the value.
Parameters:
  s - The CharSequence value to insert into thisobject. A reference to this object.
throws:
  IndexOutOfBoundsException - if offset is negative orgreater than the current StringBuilder.length().
See Also:   CharSequence.toString



insert
public StringBuilder insert(int offset, CharSequence s, int start, int end)(Code)

Inserts the String representation of the subsequence of the CharSequence value passed into this object at the offset passed. The CharSequence value is converted to a String as defined by CharSequence.subSequence(intint) . If the CharSequence is null, then the String "null" is used to determine the subsequence.


Parameters:
  offset - The index of this object to insert the value.
Parameters:
  s - The CharSequence value to insert into thisobject.
Parameters:
  start - The start of the subsequence of the sparameter.
Parameters:
  end - The end of the subsequence of the s parameter. A reference to this object.
throws:
  IndexOutOfBoundsException - if offset is negative orgreater than the current StringBuilder.length().
See Also:   CharSequence.subSequence(intint)



replace
public StringBuilder replace(int start, int end, String str)(Code)

Replaces the indicated subsequence of this object with the String passed. If the String passed is longer or shorter than the subsequence, then this object will be adjusted appropriately.


Parameters:
  start - The inclusive start index of the sequence to replace in thisobject.
Parameters:
  end - The exclusive end index of the sequence to replace in thisobject.
Parameters:
  str - The String to replace the subsequence. A reference to this object.
throws:
  StringIndexOutOfBoundsException - if start isnegative, greater than the current StringBuilder.length() or greaterthan end.
throws:
  NullPointerException - if the str parameter isnull.



reverse
public StringBuilder reverse()(Code)

Reverses the contents of this object.

A reference to this object.



toString
public String toString()(Code)
Answers the contents of this StringBuilder. a String containing the characters in this StringBuilder



Fields inherited from java.lang.AbstractStringBuilder
final static int INITIAL_CAPACITY(Code)(Java Doc)

Methods inherited from java.lang.AbstractStringBuilder
final void append0(char chars)(Code)(Java Doc)
final void append0(char chars, int start, int length)(Code)(Java Doc)
final void append0(char ch)(Code)(Java Doc)
final void append0(String string)(Code)(Java Doc)
final void append0(CharSequence s, int start, int end)(Code)(Java Doc)
final void appendNull()(Code)(Java Doc)
public int capacity()(Code)(Java Doc)
public char charAt(int index)(Code)(Java Doc)
public int codePointAt(int index)(Code)(Java Doc)
public int codePointBefore(int index)(Code)(Java Doc)
public int codePointCount(int beginIndex, int endIndex)(Code)(Java Doc)
final void delete0(int start, int end)(Code)(Java Doc)
final void deleteCharAt0(int location)(Code)(Java Doc)
public void ensureCapacity(int min)(Code)(Java Doc)
public void getChars(int start, int end, char[] dest, int destStart)(Code)(Java Doc)
final char[] getValue()(Code)(Java Doc)
public int indexOf(String string)(Code)(Java Doc)
public int indexOf(String subString, int start)(Code)(Java Doc)
final void insert0(int index, char[] chars)(Code)(Java Doc)
final void insert0(int index, char[] chars, int start, int length)(Code)(Java Doc)
final void insert0(int index, char ch)(Code)(Java Doc)
final void insert0(int index, String string)(Code)(Java Doc)
final void insert0(int index, CharSequence s, int start, int end)(Code)(Java Doc)
public int lastIndexOf(String string)(Code)(Java Doc)
public int lastIndexOf(String subString, int start)(Code)(Java Doc)
public int length()(Code)(Java Doc)
public int offsetByCodePoints(int index, int codePointOffset)(Code)(Java Doc)
final void replace0(int start, int end, String string)(Code)(Java Doc)
final void reverse0()(Code)(Java Doc)
final void set(char[] val, int len) throws InvalidObjectException(Code)(Java Doc)
public void setCharAt(int index, char ch)(Code)(Java Doc)
public void setLength(int length)(Code)(Java Doc)
final char[] shareValue()(Code)(Java Doc)
public CharSequence subSequence(int start, int end)(Code)(Java Doc)
public String substring(int start)(Code)(Java Doc)
public String substring(int start, int end)(Code)(Java Doc)
public String toString()(Code)(Java Doc)
public void trimToSize()(Code)(Java Doc)

Methods inherited from java.lang.Object
protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object object)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final public Class<? extends Object> getClass()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
final public void notify()(Code)(Java Doc)
final public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final public void wait(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait(long millis) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.