javolution.text

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 » Science » javolution 5.2 » javolution.text 
javolution.text

Provides classes and interfaces to handle text.

FAQ:

  1. Is parsing/formatting of floating-points numbers (e.g. double) equivalent to standard String/Double methods?

    With Javolution 4.1, double formatting/parsing is lossless and functionally the same as with the standard library. Parsing a character sequence will always result in the same number whether it is performed with {@link javolution.text.TypeFormat TypeFormat} or using Double.parseDouble(String)). When formatting a double number, the number of digits output is adjustable. The default (if the number of digits is unspecified) is 17 or 16 when the the 16 digits representation can be parsed back to the same double (mimic the standard library formatting).

    Javolution parsing/formatting do not generate garbage and has no adverse effect on GC. Better, it does not force the user to create intermediate String objects, any CharSequence/Appendable can be used! Serial parsing is also supported (cursor parameter).

  2. I'm accumulating a large string, and all I want to do is append to the end of the current string, which is the better class to use, Text or TextBuilder? Bearing in mind that speed is important, but I also want to conserve memory.

    It all depends of the size of the text to append (the actual size of the document being appended has almost no impact in both cases).

    If you append one character at a time or a small text then {@link javolution.text.TextBuilder#append(Object) TextBuilder.append(Object)} is faster (the cost of copying the characters to the internal buffer is then negligeable and TextBuilder never resizes its internal arrays).

    If you append larger character sequences (the threshold might be around 20 characters) then {@link javolution.text.Text#concat(Text) Text.concat(Text)} is more efficient (it avoid character copies, but creates small nodes objects instead).

  3. In our project's use of strings, there are a lot of instances of directory path names, such as "/proj/lodecase/src/com/lodecase/util/foo.java", and "/proj/lodecase/src/com/lodecase/util/bar.java". Can the 'Text' class save us memory when strings have common prefixes?

    It depends how you build your text. For example in following code:[code] Text directoryName = Text.valueOf("/proj/lodecase/src/com/lodecase/util/"); Text fooFileName = directoryName.plus("foo.java"); Text barFileName = directoryName.plus("bar.java");[/code] The prefix (directoryName)is shared between fooFileName and barFileName.

    Text is a binary tree of blocks of characters. In the example, above, fooFileName is a node with directoryName for head and "foo.java" for tail. The tree is maintained balanced automatically through tree rotations.

Java Source File NameTypeComment
Appendable.javaInterface
CharArray.javaClass

This class represents a character sequence backed up by a char array.

CharSet.javaClass

This class represents a set of characters.

Instances of this class are typically used for parsing purpose (faster than regular expressions for simple patterns).

Text.javaClass

This class represents an immutable character sequence with fast Text.concat concatenation , Text.insert insertion and Text.delete deletion capabilities (O[Log(n)]) instead of O[n] for StringBuffer/StringBuilder).

This class has the same methods as Java String and .NET String with the following benefits:

  • No need for an intermediate StringBuffer / StringBuilder in order to manipulate textual documents (insertion, deletion or concatenation).
  • Bug free.
TextBuilder.javaClass
TextFormat.javaClass

This class represents the base format for text parsing and formatting; it supports CharSequence and javolution.text.Appendable interfaces for greater flexibility.

It is possible to retrieve the format for any class for which the format has been registered (typically during class initialization). For example:[code] public class Complex extends RealtimeObject { private static final TextFormat CARTESIAN = ...; static { // Sets default format to cartesian, users may change it later (e.g.

TypeFormat.javaClass

This class provides utility methods to parse CharSequence into primitive types and to format primitive types into any Appendable.

Methods from this class do not create temporary objects and are typically faster than standard library methods (see benchmark).

The number of digits when formatting floating point numbers can be specified.

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