Java Doc for StringObject.java in  » Database-ORM » MMBase » org » mmbase » util » 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 » Database ORM » MMBase » org.mmbase.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.mmbase.util.StringObject

StringObject
final public class StringObject (Code)
This Class is a growable buffer for characters. It is mainly used to create Strings. The compiler uses it to implement the "+" operator. For example:
 "a" + 4 + "c"
 
is compiled to:
 new StringBuffer().append("a").append(4).append("c").toString()
 
Note that the method toString() does not create a copy of the internal buffer. Instead the buffer is marked as shared. Any further changes to the buffer will cause a copy to be made.

this is based on StringBuffer code, we have a seperate class since sun doesn't allow us to extend StringBuffer for some reason and we want methods like replace over the whole buffer.
See Also:   String
author:
   Daniel Ockeloen
author:
   Johannes Verelst (bugfix)
author:
   Arthur van Hoff
version:
   $Id: StringObject.java,v 1.11 2006/06/26 18:16:01 johannes Exp $




Constructor Summary
public  StringObject()
     Constructs an empty String buffer.
public  StringObject(int length)
     Constructs an empty String buffer with the specified initial length.
public  StringObject(String str)
     Constructs a String buffer with the specified initial value.

Method Summary
public synchronized  StringObjectappend(Object obj)
     Appends an object to the end of this buffer.
public synchronized  StringObjectappend(String str)
     Appends a String to the end of this buffer.
public synchronized  StringObjectappend(char str)
     Appends an array of characters to the end of this buffer.
public synchronized  StringObjectappend(char str, int offset, int len)
     Appends a part of an array of characters to the end of this buffer.
public  StringObjectappend(boolean b)
     Appends a boolean to the end of this buffer.
public synchronized  StringObjectappend(char c)
     Appends a character to the end of this buffer.
public  StringObjectappend(int i)
     Appends an integer to the end of this buffer.
public  StringObjectappend(long l)
     Appends a long to the end of this buffer.
public  StringObjectappend(float f)
     Appends a float to the end of this buffer.
public  StringObjectappend(double d)
     Appends a double to the end of this buffer.
public  intcapacity()
     Returns the current capacity of the String buffer.
public synchronized  charcharAt(int index)
     Returns the character at the specified index.
public synchronized  StringObjectdelete(int offset, int len)
    
public synchronized  voidensureCapacity(int minimumCapacity)
     Ensures that the capacity of the buffer is at least equal to the specified minimum.
public  byte[]getBytes()
    
public synchronized  voidgetChars(int srcBegin, int srcEnd, char dst, int dstBegin)
     Copies the characters of the specified substring (determined by srcBegin and srcEnd) into the character array, starting at the array's dstBegin location.
final  char[]getValue()
    
public  intindexOf(String str)
    
public  intindexOf(String str, int fromIndex)
    
public synchronized  StringObjectinsert(int offset, Object obj)
     Inserts an object into the String buffer.
public synchronized  StringObjectinsert(int offset, String str)
     Inserts a String into the String buffer.
public synchronized  StringObjectinsert(int offset, char str)
     Inserts an array of characters into the String buffer.
public  StringObjectinsert(int offset, boolean b)
     Inserts a boolean into the String buffer.
public synchronized  StringObjectinsert(int offset, char c)
     Inserts a character into the String buffer.
public  StringObjectinsert(int offset, int i)
     Inserts an integer into the String buffer.
public  StringObjectinsert(int offset, long l)
     Inserts a long into the String buffer.
public  StringObjectinsert(int offset, float f)
     Inserts a float into the String buffer.
public  StringObjectinsert(int offset, double d)
     Inserts a double into the String buffer.
public synchronized  StringObjectinsertLinks(String oldstart, String oldend, String newstart, String newend, String startend)
    
public  intlength()
     Returns the length (character count) of the buffer.
public synchronized  StringObjectreplace(int offset, int len, String str)
    
public synchronized  StringObjectreplace(String oldstr, String newstr)
    
public synchronized  StringObjectreplace(String oldstart, String oldend, String newstart, String newend)
     Does a replace/insert.
public synchronized  StringObjectreplaceFirst(String oldstr, String newstr)
    
public synchronized  StringObjectreverse()
     Reverse the order of the characters in the String buffer.
public synchronized  voidsetCharAt(int index, char ch)
     Changes the character at the specified index to be ch.
public synchronized  voidsetLength(int newLength)
     Sets the length of the String.
final  voidsetShared()
    
public  StringtoString()
     Converts to a String representing the data in the buffer.


Constructor Detail
StringObject
public StringObject()(Code)
Constructs an empty String buffer.



StringObject
public StringObject(int length)(Code)
Constructs an empty String buffer with the specified initial length.
Parameters:
  length - the initial length



StringObject
public StringObject(String str)(Code)
Constructs a String buffer with the specified initial value.
Parameters:
  str - the initial value of the buffer




Method Detail
append
public synchronized StringObject append(Object obj)(Code)
Appends an object to the end of this buffer.
Parameters:
  obj - the object to be appended the StringBuffer itself, NOT a new one.



append
public synchronized StringObject append(String str)(Code)
Appends a String to the end of this buffer.
Parameters:
  str - the String to be appended the StringBuffer itself, NOT a new one.



append
public synchronized StringObject append(char str)(Code)
Appends an array of characters to the end of this buffer.
Parameters:
  str - the characters to be appended the StringBuffer itself, NOT a new one.



append
public synchronized StringObject append(char str, int offset, int len)(Code)
Appends a part of an array of characters to the end of this buffer.
Parameters:
  str - the characters to be appended
Parameters:
  offset - where to start
Parameters:
  len - the number of characters to add the StringBuffer itself, NOT a new one.



append
public StringObject append(boolean b)(Code)
Appends a boolean to the end of this buffer.
Parameters:
  b - the boolean to be appended the StringBuffer itself, NOT a new one.



append
public synchronized StringObject append(char c)(Code)
Appends a character to the end of this buffer.
Parameters:
  c - the character to be appended the StringBuffer itself, NOT a new one.



append
public StringObject append(int i)(Code)
Appends an integer to the end of this buffer.
Parameters:
  i - the integer to be appended the StringBuffer itself, NOT a new one.



append
public StringObject append(long l)(Code)
Appends a long to the end of this buffer.
Parameters:
  l - the long to be appended the StringBuffer itself, NOT a new one.



append
public StringObject append(float f)(Code)
Appends a float to the end of this buffer.
Parameters:
  f - the float to be appended the StringBuffer itself, NOT a new one.



append
public StringObject append(double d)(Code)
Appends a double to the end of this buffer.
Parameters:
  d - the double to be appended the StringBuffer itself, NOT a new one.



capacity
public int capacity()(Code)
Returns the current capacity of the String buffer. The capacity is the amount of storage available for newly inserted characters; beyond which an allocation will occur.



charAt
public synchronized char charAt(int index)(Code)
Returns the character at the specified index. An index ranges from 0..length()-1.
Parameters:
  index - the index of the desired character
exception:
  StringIndexOutOfBoundsException - If the index is invalid.



delete
public synchronized StringObject delete(int offset, int len)(Code)
delete part of the buffer



ensureCapacity
public synchronized void ensureCapacity(int minimumCapacity)(Code)
Ensures that the capacity of the buffer is at least equal to the specified minimum.
Parameters:
  minimumCapacity - the minimum desired capacity



getBytes
public byte[] getBytes()(Code)



getChars
public synchronized void getChars(int srcBegin, int srcEnd, char dst, int dstBegin)(Code)
Copies the characters of the specified substring (determined by srcBegin and srcEnd) into the character array, starting at the array's dstBegin location. Both srcBegin and srcEnd must be legal indexes into the buffer.
Parameters:
  srcBegin - begin copy at this offset in the String
Parameters:
  srcEnd - stop copying at this offset in the String
Parameters:
  dst - the array to copy the data into
Parameters:
  dstBegin - offset into dst
exception:
  StringIndexOutOfBoundsException - If there is an invalid index into the buffer.



getValue
final char[] getValue()(Code)



indexOf
public int indexOf(String str)(Code)



indexOf
public int indexOf(String str, int fromIndex)(Code)



insert
public synchronized StringObject insert(int offset, Object obj)(Code)
Inserts an object into the String buffer.
Parameters:
  offset - the offset at which to insert
Parameters:
  obj - the object to insert the StringBuffer itself, NOT a new one.
exception:
  StringIndexOutOfBoundsException - If the offset is invalid.



insert
public synchronized StringObject insert(int offset, String str)(Code)
Inserts a String into the String buffer.
Parameters:
  offset - the offset at which to insert
Parameters:
  str - the String to insert the StringBuffer itself, NOT a new one.
exception:
  StringIndexOutOfBoundsException - If the offset is invalid.



insert
public synchronized StringObject insert(int offset, char str)(Code)
Inserts an array of characters into the String buffer.
Parameters:
  offset - the offset at which to insert
Parameters:
  str - the characters to insert the StringBuffer itself, NOT a new one.
exception:
  StringIndexOutOfBoundsException - If the offset is invalid.



insert
public StringObject insert(int offset, boolean b)(Code)
Inserts a boolean into the String buffer.
Parameters:
  offset - the offset at which to insert
Parameters:
  b - the boolean to insert the StringBuffer itself, NOT a new one.
exception:
  StringIndexOutOfBoundsException - If the offset is invalid.



insert
public synchronized StringObject insert(int offset, char c)(Code)
Inserts a character into the String buffer.
Parameters:
  offset - the offset at which to insert
Parameters:
  c - the character to insert the StringBuffer itself, NOT a new one.
exception:
  StringIndexOutOfBoundsException - If the offset invalid.



insert
public StringObject insert(int offset, int i)(Code)
Inserts an integer into the String buffer.
Parameters:
  offset - the offset at which to insert
Parameters:
  i - the integer to insert the StringBuffer itself, NOT a new one.
exception:
  StringIndexOutOfBoundsException - If the offset is invalid.



insert
public StringObject insert(int offset, long l)(Code)
Inserts a long into the String buffer.
Parameters:
  offset - the offset at which to insert
Parameters:
  l - the long to insert the StringBuffer itself, NOT a new one.
exception:
  StringIndexOutOfBoundsException - If the offset is invalid.



insert
public StringObject insert(int offset, float f)(Code)
Inserts a float into the String buffer.
Parameters:
  offset - the offset at which to insert
Parameters:
  f - the float to insert the StringBuffer itself, NOT a new one.
exception:
  StringIndexOutOfBoundsException - If the offset is invalid.



insert
public StringObject insert(int offset, double d)(Code)
Inserts a double into the String buffer.
Parameters:
  offset - the offset at which to insert
Parameters:
  d - the double to insert the StringBuffer itself, NOT a new one.
exception:
  StringIndexOutOfBoundsException - If the offset is invalid.



insertLinks
public synchronized StringObject insertLinks(String oldstart, String oldend, String newstart, String newend, String startend)(Code)
inserts links



length
public int length()(Code)
Returns the length (character count) of the buffer.



replace
public synchronized StringObject replace(int offset, int len, String str)(Code)
replace



replace
public synchronized StringObject replace(String oldstr, String newstr)(Code)
replace



replace
public synchronized StringObject replace(String oldstart, String oldend, String newstart, String newend)(Code)
Does a replace/insert. Like make bold:bla into <:b>:bla<:/b>:



replaceFirst
public synchronized StringObject replaceFirst(String oldstr, String newstr)(Code)
replace



reverse
public synchronized StringObject reverse()(Code)
Reverse the order of the characters in the String buffer.



setCharAt
public synchronized void setCharAt(int index, char ch)(Code)
Changes the character at the specified index to be ch.
Parameters:
  index - the index of the character
Parameters:
  ch - the new character
exception:
  StringIndexOutOfBoundsException - If the index is invalid.



setLength
public synchronized void setLength(int newLength)(Code)
Sets the length of the String. If the length is reduced, characters are lost. If the length is extended, the values of the new characters are set to 0.
Parameters:
  newLength - the new length of the buffer
exception:
  StringIndexOutOfBoundsException - If the length is invalid.



setShared
final void setShared()(Code)



toString
public String toString()(Code)
Converts to a String representing the data in the buffer.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) 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.