Home Page Icon
Home Page
Table of Contents for
Jakarta Commons Cookbook
Close
Jakarta Commons Cookbook
by Timothy M. O'Brien
Jakarta Commons Cookbook
Jakarta Commons Cookbook
Preface
What’s Inside
Conventions Used in This Book
What You’ll Need
The Jakarta Commons Community
The Apache Software License
Using Code Examples
We’d Like to Hear from You
Acknowledgments
1. Supplements to the Java 2 Platform
Introduction
1.1. Obtaining Commons Lang
Problem
Solution
Discussion
See Also
1.2. Joining the Commons-User Mailing List
Problem
Solution
Discussion
See Also
1.3. Getting the Commons Lang Source Code
Problem
Solution
Discussion
See Also
1.4. Automating the Generation of toString( ) Content
Problem
Solution
Discussion
1.5. Customizing Generated toString( ) Content
Problem
Solution
Discussion
1.6. Automating hashCode( ) and equals( )
Problem
Solution
Discussion
1.7. Automating compareTo( )
Problem
Solution
Discussion
See Also
1.8. Printing an Array
Problem
Solution
Discussion
1.9. Cloning and Reversing Arrays
Problem
Solution
Discussion
1.10. Transforming Between Object Arraysand Primitive Arrays
Problem
Solution
Discussion
See Also
1.11. Finding Items in an Array
Problem
Solution
Discussion
See Also
1.12. Creating a Map from a Multidimensional Array
Problem
Solution
Discussion
See Also
1.13. Formatting Dates
Problem
Solution
Discussion
See Also
1.14. Rounding Date Objects
Problem
Solution
Discussion
See Also
1.15. Truncating Date Objects
Problem
Solution
Discussion
See Also
1.16. Creating an Enum
Problem
Solution
Discussion
See Also
1.17. Generating Unique Numeric Identifiers
Problem
Solution
Discussion
See Also
1.18. Validation of Method Parameters
Problem
Solution
Discussion
See Also
1.19. Measuring Time
Problem
Solution
Discussion
2. Manipulating Text
Introduction
2.1. Setting Up StringUtils and WordUtils
Problem
Solution
Discussion
See Also
2.2. Checking for an Empty String
Problem
Solution
Discussion
2.3. Abbreviating Strings
Problem
Solution
Discussion
2.4. Splitting a String
Problem
Solution
Discussion
See Also
2.5. Finding Nested Strings
Problem
Solution
Discussion
2.6. Stripping and Trimming a String
Problem
Solution
Discussion
Stripping a string
Trimming to null
2.7. Chomping a String
Problem
Solution
2.8. Creating an Emphasized Header
Problem
Solution
Discussion
2.9. Reversing a String
Problem
Solution
Discussion
2.10. Wrapping Words
Problem
Solution
Discussion
2.11. Testing the Contents of a String
Problem
Solution
Discussion
2.12. Measuring the Frequency of a String
Problem
Solution
Discussion
See Also
2.13. Parsing Formatted Strings
Problem
Solution
Discussion
2.14. Calculating String Difference
Problem
Solution
Discussion
See Also
2.15. Using Commons Codec
Problem
Solution
Discussion
See Also
2.16. Getting the Commons Codec Source Code
Problem
Solution
See Also
2.17. Calculating Soundex
Problem
Solution
Discussion
See Also
3. JavaBeans
Introduction
3.1. Representing Beans Graphically
Problem
Solution
Discussion
See Also
3.2. Obtaining Commons BeanUtils
Problem
Solution
Discussion
See Also
3.3. Getting the Commons BeanUtils Source Code
Problem
Solution
See Also
3.4. Accessing Simple Bean Properties
Problem
Solution
Discussion
See Also
3.5. Accessing Nested Bean Properties
Problem
Solution
Discussion
3.6. Accessing Indexed Bean Properties
Problem
Solution
Discussion
3.7. Accessing Mapped Bean Properties
Problem
Solution
Discussion
3.8. Accessing a Simple, Nested, Indexed, and Mapped Bean Property
Problem
Solution
Discussion
See Also
3.9. Determining the Type of a Bean Property
Problem
Solution
Discussion
3.10. Comparing Beans
Problem
Solution
Discussion
See Also
3.11. Copying Bean Properties
Problem
Solution
Discussion
See Also
3.12. Cloning a Bean
Problem
Solution
Discussion
3.13. Setting a Bean Property
Problem
Solution
Discussion
3.14. Testing Property Access
Problem
Solution
Discussion
3.15. Validating Beans with Predicates
Problem
Solution
Discussion
See Also
3.16. Creating a Map of Bean Properties
Problem
Solution
Discussion
See Also
3.17. Wrapping a Bean with a Map
Problem
Solution
Discussion
See Also
3.18. Creating a Dynamic Bean
Problem
Solution
Discussion
See Also
3.19. Getting and Setting Properties as Strings
Problem
Solution
Discussion
See Also
4. Functors
Introduction
4.1. Obtaining Commons Collections
Problem
Solution
Discussion
See Also
4.2. Getting the Commons Collections Source Code
Problem
Solution
See Also
4.3. Reversing a Comparator
Problem
Solution
Discussion
See Also
4.4. Chaining Comparators
Problem
Solution
Discussion
See Also
4.5. Comparing Nulls
Problem
Solution
Discussion
See Also
4.6. Fixed-Order Comparison
Problem
Solution
Discussion
See Also
4.7. Using Simple Predicates
Problem
Solution
Discussion
See Also
4.8. Writing a Custom Predicate
Problem
Solution
Discussion
See Also
4.9. Creating Composite Predicates
Problem
Solution
Discussion
4.10. Transforming Objects
Problem
Solution
Discussion
See Also
4.11. Creating a Chain of Transformations
Problem
Solution
Discussion
See Also
4.12. Applying Conditional Transformations
Problem
Solution
Discussion
See Also
4.13. Writing a Closure
Problem
Solution
Discussion
See Also
4.14. Chaining Closures
Problem
Solution
Discussion
See Also
4.15. Modeling Conditional Statements with Closures
Problem
Solution
Discussion
4.16. Modeling Loops with Closures
Problem
Solution
Discussion
5. Collections
Introduction
5.1. Obtaining Commons Collections
Problem
Solution
See Also
5.2. Using a Looping Iterator
Problem
Solution
Discussion
See Also
5.3. Iterating Over an ArrayList
Problem
Solution
Discussion
See Also
5.4. Filtering a Collection with a Predicate
Problem
Solution
Discussion
See Also
5.5. Iterating Through Distinct Elements
Problem
Solution
Discussion
See Also
5.6. Using a Bag
Problem
Solution
Discussion
See Also
5.7. Using a Buffer
Problem
Solution
Discussion
See Also
5.8. Creating a Priority Queue
Problem
Solution
Discussion
See Also
5.9. Using a Blocking Buffer
Problem
Solution
Discussion
See Also
5.10. Storing Multiple Values in a Map
Problem
Solution
Discussion
5.11. Retrieving a Key by a Value
Problem
Solution
Discussion
See Also
5.12. Using a Case-Insensitive Map
Problem
Solution
Discussion
See Also
5.13. Creating Typed Collections and Maps
Problem
Solution
Discussion
See Also
5.14. Constraining Map Values
Problem
Solution
Discussion
5.15. Constraining List Contents
Problem
Solution
Discussion
See Also
5.16. Transforming Collections
Problem
Solution
Discussion
See Also
5.17. Creating a Least Recently Used Cache
Problem
Solution
Discussion
See Also
5.18. Using a Lazy Map
Problem
Solution
Discussion
See Also
5.19. Counting Objects in a Collection
Problem
Solution
Discussion
See Also
5.20. Performing Set Operations
Problem
Solution
Discussion
5.21. Retrieving Map Values Without Casting
Problem
Solution
Discussion
6. XML
Introduction
6.1. Obtaining Jakarta Commons Digester
Problem
Solution
Discussion
See Also
6.2. Turning XML Documents into Objects
Problem
Solution
Discussion
See Also
6.3. Namespace-Aware Parsing
Problem
Solution
Discussion
See Also
6.4. Creating a Simple XML Command Language
Problem
Solution
Discussion
See Also
6.5. Variable Substitution and XML Parsing
Problem
Solution
Discussion
See Also
6.6. Obtaining Jakarta Commons Betwixt
Problem
Solution
Discussion
See Also
6.7. Turning Beans into XML Documents
Problem
Solution
Discussion
See Also
6.8. Customizing XML Generated from an Object
Problem
Solution
Discussion
See Also
6.9. Turning XML Documents into Beans
Problem
Solution
Discussion
See Also
7. Application Infrastructure
Introduction
7.1. Obtaining Commons CLI
Problem
Solution
Discussion
See Also
7.2. Parsing a Simple Command Line
Problem
Solution
Discussion
See Also
7.3. Parsing a Complex Command Line
Problem
Solution
Discussion
See Also
7.4. Printing Usage Information
Problem
Solution
Discussion
7.5. Obtaining Commons Configuration
Problem
Solution
Discussion
See Also
7.6. Configuring Applications with Properties Files
Problem
Solution
Discussion
See Also
7.7. Configuring Applications with XML
Problem
Solution
Discussion
See Also
7.8. Using Composite Configuration
Problem
Solution
Discussion
See Also
7.9. Obtaining Commons Logging
Problem
Solution
Discussion
See Also
7.10. Using an Abstract Logging Interface
Problem
Solution
Discussion
See Also
7.11. Specifying a Logging Implementation
Problem
Solution
Discussion
See Also
7.12. Obtaining Apache Log4J
Problem
Solution
Discussion
See Also
7.13. Configuring Log4J with a Properties File
Problem
Solution
Discussion
See Also
7.14. Configuring Log4J with XML
Problem
Solution
See Also
8. Math
Introduction
8.1. Using Fractions
Problem
Solution
Discussion
See Also
8.2. Finding the Maximum and Minimum in an Array
Problem
Solution
Discussion
8.3. Using Number Ranges
Problem
Solution
Discussion
See Also
8.4. Generating Random Variables
Problem
Solution
Discussion
8.5. Obtaining Commons Math
Problem
Solution
Discussion
See Also
8.6. Calculating Simple Univariate Statistics
Problem
Solution
Discussion
See Also
8.7. Solving a System of Linear Equations
Problem
Solution
Discussion
See Also
8.8. Arithmetic with Complex Numbers
Problem
Solution
Discussion
See also
8.9. Establishing Relationships Between Variables
Problem
Solution
Discussion
See Also
8.10. Estimating the Amount of Time Left in a Process
Problem
Solution
Discussion
See Also
9. Templating
Introduction
Common Templating Problems in Applications
Templating in Web Applications
9.1. Obtaining Commons JEXL
Problem
Solution
Discussion
See Also
9.2. Using an Expression Language
Problem
Solution
Discussion
See Also
9.3. Invoking Methods in an Expression
Problem
Solution
Discussion
See Also
9.4. Externalizing Logic with an Expression Language
Problem
Solution
Discussion
See Also
9.5. Obtaining Jakarta Velocity
Problem
Solution
Discussion
See Also
9.6. Using a Simple Templating Language
Problem
Solution
Discussion
See Also
9.7. Writing Templates with Conditionals and Loops
Problem
Solution
Discussion
See Also
9.8. Using Macros in a Templating Engine
Problem
Solution
Discussion
See Also
9.9. Invoking Methods in a Template
Problem
Solution
Discussion
See Also
9.10. Obtaining FreeMarker
Problem
Solution
Discussion
See Also
9.11. Using a Complex Scripting Engine
Problem
Solution
Discussion
See Also
9.12. Accessing XML Documents from a Templating Engine
Problem
Solution
Discussion
See Also
9.13. Using Velocity in a Web Application
Problem
Solution
Discussion
See Also
9.14. Using FreeMarker in a Web Application
Problem
Solution
Discussion
See Also
9.15. Writing Templates in Eclipse
Problem
Solution
See Also
10. I/O and Networking
Introduction
10.1. Obtaining Commons IO
Problem
Solution
Discussion
See Also
10.2. Copying Streams, byte[ ], Readers, and Writers
Problem
Solution
Discussion
10.3. Closing Streams, Readers, and Writers
Problem
Solution
Discussion
See Also
10.4. Printing a Human-Readable File Size
Problem
Solution
Discussion
10.5. Copying Files, Strings, and URLs
Problem
Solution
Discussion
10.6. Deleting Directories Recursively
Problem
Solution
Discussion
10.7. Obtaining the Size of a Directory
Problem
Solution
10.8. Touching a File
Problem
Solution
10.9. Filtering Files
Problem
Solution
Discussion
10.10. Measuring Stream Traffic
Problem
Solution
Discussion
10.11. Splitting an OutputStream
Problem
Solution
10.12. Obtaining Jakarta ORO
Problem
Solution
Discussion
See Also
10.13. Using Globs and Perl5 Regular Expressions to List Files
Problem
Solution
10.14. Obtaining Commons Net
Problem
Solution
Discussion
See Also
10.15. Writing an FTP Client
Problem
Solution
Discussion
See Also
10.16. Sending Mail with SMTP
Problem
Solution
Discussion
See Also
10.17. Checking a POP3 Mailbox
Problem
Solution
Discussion
See Also
11. HTTP and WebDAV
Introduction
11.1. Obtaining Jakarta HttpClient
Problem
Solution
Discussion
See Also
11.2. Getting Jakarta HttpClient Source Code
Problem
Solution
Discussion
See Also
11.3. Performing an HTTP GET
Problem
Solution
Discussion
See Also
11.4. Sending Parameters in a Query String
Problem
Solution
Discussion
See Also
11.5. Retrieving Content with a Conditional GET
Problem
Solution
Discussion
See Also
11.6. Debugging HTTP Communications
Problem
Solution
Discussion
11.7. Making an HTTP POST Request
Problem
Discussion
Discussion
See Also
11.8. Sending POST Data from a File
Problem
Solution
Discussion
11.9. Uploading Files with a Multipart POST
Problem
Solution
Discussion
See Also
11.10. Basic Authentication
Problem
Solution
Discussion
See Also
11.11. NTLM Authentication
Problem
Solution
Discussion
See Also
11.12. Working with Cookies
Problem
Solution
Discussion
See Also
11.13. Handling Redirects
Problem
Solution
Discussion
See Also
11.14. SSL
Problem
Solution
Discussion
See Also
11.15. Accepting a Self-Signed Certificate
Problem
Solution
Discussion
See Also
11.16. Obtaining Jakarta Slide
Problem
Solution
Discussion
See Also
11.17. Connecting to WebDAV Resources
Problem
Solution
Discussion
11.18. Modifying a WebDAV Resource
Problem
Solution
Discussion
See Also
12. Searching and Filtering
Introduction
12.1. Obtaining Commons JXPath
Problem
Solution
Discussion
See Also
12.2. Querying an Object Graph with XPath
Problem
Solution
Discussion
See Also
12.3. Search a Collection of Simple Objects
Problem
Solution
Discussion
See Also
12.4. Applying XPath Queries to Complex Object Graphs
Problem
Solution
Discussion
See Also
12.5. Obtaining Jakarta Lucene
Problem
Solution
Discussion
See Also
12.6. Creating an Index of XML Documents
Problem
Solution
Discussion
See Also
12.7. Searching for a Specific Term in a Document Index
Problem
Solution
Discussion
See Also
12.8. Finding the Frequency of Terms in an Index
Problem
Solution
Discussion
See Also
Index
Colophon
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Cover
Next
Next Chapter
Preface
Jakarta Commons Cookbook
Timothy M. O'Brien
Editor
Brett McLaughlin
Copyright © 2004 O'Reilly Media, Inc.
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset