Java Cookbook
Home > Computing and Information Technology > Computer programming / software engineering > Web programming > Java Cookbook
Java Cookbook

Java Cookbook


     0     
5
4
3
2
1



Out of Stock


Notify me when this book is in stock
X
About the Book

A comprehensive collection of problems, solutions, and practical examples for anyone programming in Java. Developers are provided with find hundreds of Java "recipes" covering all of the major APIs as well as some APIs that aren't as well documented in other Java books. "The Java Cookbook", like the "Perl Cookbook", offers Java developers short, focused pieces of code that can be easily incorporated into other programs. The idea is to focus on things that are useful, tricky, or both. The book includes code segments covering many specialized APIs - like media and servlets - and should serve as a "jumping-off place" for Java developers who want to get started in areas outside of their specialization. The book provides quick solutions to particular problems that can be incorporated into other programs, but that aren't usually programs in and of themselves.

Table of Contents:
1. Getting Started: Compiling, Running, and Debugging Compiling and Running Java: JDK Editing and Compiling with a Color-Highlighting Editor Compiling, Running, and Testing with an IDE Using Classes from This Book Automating Compilation with jr Automating Compilation with make Automating Compilation with Ant Running Applets Dealing with Deprecation Warnings Conditional Debugging without ifdef Debugging Printouts Using a Debugger Unit Testing: Avoid the Need for Debuggers Decompiling Java Class Files Preventing Others from Decompiling Your Java Files Getting Readable Tracebacks Finding More Java Source Code Program: Debug 2. Interacting with the Environment Getting Environment Variables System Properties Writing JDK Release-Dependent Code Writing Operating System-Dependent Code Using CLASSPATH Effectively Using Extensions or Other Packaged APIs Parsing Command-Line Arguments 3. Strings and Things Taking Strings Apart with Substrings Taking Strings Apart with StringTokenizer Putting Strings Together with + and StringBuffer Processing a String One Character at a Time Aligning Strings Converting Between Unicode Characters and Strings Reversing a String by Word or Character Expanding and Compressing Tabs Controlling Case Indenting Text Documents Entering Non-Printable Characters Trimming Blanks from the End of a String Parsing Comma-Separated Data Program: A Simple Text Formatter Program: Soundex Name Comparisons 4. Pattern Matching with Regular Expressions Regular Expression Syntax How REs Work in Practice Using Regular Expressions in Java Testing REs Interactively Finding the Matching Text Replacing the Matching Text Printing All Occurrences of a Pattern Printing Lines Containing a Pattern Controlling Case in match( ) and subst( ) Precompiling the RE Matching Newlines in Text Program: Data Mining Program: Full Grep 5. Numbers Checking Whether a String Is a Valid Number Storing a Larger Number in a Smaller Taking a Fraction of an Integer Without Using Floating Point Ensuring the Accuracy of Floating-Point Numbers Comparing Floating-Point Numbers Rounding Floating-Point Numbers Formatting Numbers Converting Between Binary, Octal, Decimal, and Hexadecimal Operating on a Series of Integers Working with Roman Numerals Formatting with Correct Plurals Generating Random Numbers Generating Better Random Numbers Calculating Trigonometric Functions Taking Logarithms Multiplying Matrixes Using Complex Numbers Handling Very Large Numbers Program: TempConverter Program: Number Palindromes 6. Dates and Times Finding Today's Date Printing Date/Time in a Specified Format Representing Dates in Other Epochs Converting YMDHMS to a Calendar or Epoch Seconds Parsing Strings into Dates Converting Epoch Seconds to DMYHMS Adding to or Subtracting from a Date or Calendar Difference Between Two Dates Comparing Dates Day of Week/Month/Year or Week Number Calendar Page High-Resolution Timers Sleeping for a While Program: Reminder Service 7. Structuring Data with Java Data Structuring Using Arrays Resizing an Array Like an Array, but More Dynamic Data-Independent Access with Iterators Structuring Data in a Linked List Mapping with Hashtable and HashMap Storing Strings in Properties and Preferences Sorting a Collection Sorting in Java 1.1 Avoiding the Urge to Sort Sets Finding an Object in a Collection Converting a Collection to an Array Rolling Your Own Iterator Stack Multidimensional Structures Finally, Collections Program: Timing Comparisons 8. Object-Oriented Techniques Printing Objects: Formatting with toString( ) Overriding the Equals Method Overriding the Hashcode Method The Clone Method The Finalize Method Using Inner Classes Providing Callbacks via Interfaces Polymorphism/Abstract Methods Passing Values Roll Your Own Exceptions Program: Plotter 9. Input and Output Reading Standard Input Writing Standard Output Opening a File by Name Copying a File Reading a File into a String Reassigning the Standard Streams Duplicating a Stream as It Is Written Reading/Writing a Different Character Set Those Pesky End-of-Line Characters Beware Platform-Dependent File Code Reading "Continued" Lines Scanning a File Binary Data Seeking Writing Data Streams from C Saving and Restoring Serialized Objects Preventing ClassCastExceptions with SerialVersionUID Reading and Writing JAR or Zip Archives Reading and Writing Compressed Files Program: Text to PostScript Program: TarList (File Converter) 10. Directory and Filesystem Operations Getting File Information Creating a File Renaming a File Deleting a File Creating a Transient File Changing File Attributes Listing a Directory Getting the Directory Roots Making New Directories Program: Find 11. Programming Serial and Parallel Ports Choosing a Port Opening a Serial Port Opening a Parallel Port Resolving Port Conflicts Reading and Writing: Lock Step Reading and Writing: Event-Driven Reading and Writing: Threads Program: Penman Plotter 12. Graphics and Sound Painting with a Graphics Object Testing Graphical Components Drawing Text Drawing Centered Text in a Component Drawing a Drop Shadow Drawing an Image Playing a Sound File Displaying a Moving Image with Video Drawing Text with 2D Printing: JDK 1.1 Printing: Java 2 Program: PlotterAWT Program: Grapher 13. Graphical User Interfaces Displaying GUI Components Designing a Window Layout A Tabbed View of Life Action Handling: Making Buttons Work Action Handling Using Anonymous Inner Classes Terminating a Program with "Window Close" Dialogs: When Later Just Won't Do Getting Program Output into a Window Choosing a File with JFileChooser Choosing a Color Centering a Main Window Changing a Swing Program's Look and Feel Program: Custom Font Chooser Program: Custom Layout Manager 14. Internationalization and Localization Creating a Button with I18N Resources Listing Available Locales Creating a Menu with I18N Resources Writing Internationalization Convenience Routines Creating a Dialog with I18N Resources Creating a Resource Bundle JILTing Your Code Using a Particular Locale Setting the Default Locale Formatting Messages Program: MenuIntl Program: BusCard 15. Network Clients Contacting a Server Finding and Reporting Network Addresses Handling Network Errors Reading and Writing Textual Data Reading and Writing Binary Data Reading and Writing Serialized Data UDP Datagrams Program: TFTP UDP Client Program: Telnet Client Program: Chat Client 16. Server-Side Java: Sockets Opening a Server for Business Returning a Response (String or Binary) Returning Object Information Handling Multiple Clients Network Logging Program: A Java Chat Server 17. Network Clients II: Applets and Web Clients Embedding Java in a Web Page Applet Techniques Contacting a Server on the Applet Host Making an Applet Show a Document Making an Applet Run a CGI Script Reading the Contents of a URL Extracting HTML from a URL Extracting URLs from a File Converting a Filename to a URL Program: MkIndex Program: LinkChecker 18. Web Server Java: Servlets and JSP First Servlet: Generating anHTML Page Servlets: Processing Form Parameters Cookies Session Tracking Generating PDF from a Servlet HTML Meets Java: JSP JSP Include/Forward JavaServer Pages Using a Servlet Simplifying Your JSP with a JavaBean JSP Syntax Summary Program: CookieCutter Program: JabaDot Web News Portal 19. Java and Electronic Mail Sending Email: Browser Version Sending Email: For Real Mail-Enabling a Server Program Sending MIME Mail Providing Mail Settings Sending Mail Without Using JavaMail Reading Email Program: MailReaderBean Program: MailClient 20. Database Access Text-File Databases DBM Databases JDBC Setup and Connection Connecting to a JDBC Database Sending a JDBC Query and Getting Results Using JDBC Parameterized Statements Using Stored Procedures with JDBC Changing Data Using a ResultSet Changing Data Using SQL Finding JDBC Metadata Program: JDAdmin 21. XML Transforming XML with XSLT Parsing XML with SAX Parsing XML with DOM Verifying Structure with a DTD Generating Your Own XML with DOM Program: xml2mif 22. Distributed Java: RMI Defining the RMI Contract RMI Client RMI Server Deploying RMI Across a Network Program: RMI Callbacks Program: RMIWatch 23. Packages and Packaging Creating a Package Documenting Classes with Javadoc Archiving with jar Running an Applet from a JAR Running an Applet with a JDK Running a Program from a JAR Preparing a Class as a JavaBean Pickling Your Bean into a JAR Packaging a Servlet into a WAR File "Write Once, Install Anywhere" Java Web Start Signing Your JAR File 24. Threaded Java Running Code in a Different Thread Displaying a Moving Image with Animation Stopping a Thread Rendezvous and Timeouts Thread Communication: Synchronized Code Thread Communication: wait( ) and notifyAll( ) Background Saving in an Editor Threaded Network Server 25. Introspection, or "A Class Named Class" Getting a Class Descriptor Finding and Using Methods and Fields Loading and Instantiating a Class Dynamically Constructing a Class from Scratch Performance Timing Printing Class Information Program: CrossRef Program: AppletViewer 26. Using Java with Other Languages Running a Program Running a Program and Capturing Its Output Mixing Java and Scripts with BSF Blending in Native Code (C/C++) Calling Java from Native Code Program: DBM Index

Review :
"...a clear, bright piece of work, bursting at the seams with ideas for connoisseurs and snackers alike." John McLaughlin, Cvu, August


Best Sellers


Product Details
  • ISBN-13: 9780596001704
  • Publisher: O'Reilly Media
  • Publisher Imprint: O'Reilly Media
  • Height: 234 mm
  • Returnable: N
  • Width: 178 mm
  • ISBN-10: 0596001703
  • Publisher Date: 31 Jul 2001
  • Binding: Book
  • Language: English
  • Weight: 1230 gr


Add Photo
Add Photo

Customer Reviews

REVIEWS      0     
Click Here To Be The First to Review this Product
Java Cookbook
O'Reilly Media -
Java Cookbook
Writing guidlines
We want to publish your review, so please:
  • keep your review on the product. Review's that defame author's character will be rejected.
  • Keep your review focused on the product.
  • Avoid writing about customer service. contact us instead if you have issue requiring immediate attention.
  • Refrain from mentioning competitors or the specific price you paid for the product.
  • Do not include any personally identifiable information, such as full names.

Java Cookbook

Required fields are marked with *

Review Title*
Review
    Add Photo Add up to 6 photos
    Would you recommend this product to a friend?
    Tag this Book Read more
    Does your review contain spoilers?
    What type of reader best describes you?
    I agree to the terms & conditions
    You may receive emails regarding this submission. Any emails will include the ability to opt-out of future communications.

    CUSTOMER RATINGS AND REVIEWS AND QUESTIONS AND ANSWERS TERMS OF USE

    These Terms of Use govern your conduct associated with the Customer Ratings and Reviews and/or Questions and Answers service offered by Bookswagon (the "CRR Service").


    By submitting any content to Bookswagon, you guarantee that:
    • You are the sole author and owner of the intellectual property rights in the content;
    • All "moral rights" that you may have in such content have been voluntarily waived by you;
    • All content that you post is accurate;
    • You are at least 13 years old;
    • Use of the content you supply does not violate these Terms of Use and will not cause injury to any person or entity.
    You further agree that you may not submit any content:
    • That is known by you to be false, inaccurate or misleading;
    • That infringes any third party's copyright, patent, trademark, trade secret or other proprietary rights or rights of publicity or privacy;
    • That violates any law, statute, ordinance or regulation (including, but not limited to, those governing, consumer protection, unfair competition, anti-discrimination or false advertising);
    • That is, or may reasonably be considered to be, defamatory, libelous, hateful, racially or religiously biased or offensive, unlawfully threatening or unlawfully harassing to any individual, partnership or corporation;
    • For which you were compensated or granted any consideration by any unapproved third party;
    • That includes any information that references other websites, addresses, email addresses, contact information or phone numbers;
    • That contains any computer viruses, worms or other potentially damaging computer programs or files.
    You agree to indemnify and hold Bookswagon (and its officers, directors, agents, subsidiaries, joint ventures, employees and third-party service providers, including but not limited to Bazaarvoice, Inc.), harmless from all claims, demands, and damages (actual and consequential) of every kind and nature, known and unknown including reasonable attorneys' fees, arising out of a breach of your representations and warranties set forth above, or your violation of any law or the rights of a third party.


    For any content that you submit, you grant Bookswagon a perpetual, irrevocable, royalty-free, transferable right and license to use, copy, modify, delete in its entirety, adapt, publish, translate, create derivative works from and/or sell, transfer, and/or distribute such content and/or incorporate such content into any form, medium or technology throughout the world without compensation to you. Additionally,  Bookswagon may transfer or share any personal information that you submit with its third-party service providers, including but not limited to Bazaarvoice, Inc. in accordance with  Privacy Policy


    All content that you submit may be used at Bookswagon's sole discretion. Bookswagon reserves the right to change, condense, withhold publication, remove or delete any content on Bookswagon's website that Bookswagon deems, in its sole discretion, to violate the content guidelines or any other provision of these Terms of Use.  Bookswagon does not guarantee that you will have any recourse through Bookswagon to edit or delete any content you have submitted. Ratings and written comments are generally posted within two to four business days. However, Bookswagon reserves the right to remove or to refuse to post any submission to the extent authorized by law. You acknowledge that you, not Bookswagon, are responsible for the contents of your submission. None of the content that you submit shall be subject to any obligation of confidence on the part of Bookswagon, its agents, subsidiaries, affiliates, partners or third party service providers (including but not limited to Bazaarvoice, Inc.)and their respective directors, officers and employees.

    Accept

    New Arrivals


    Inspired by your browsing history


    Your review has been submitted!

    You've already reviewed this product!