did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9780596001704

Java Cookbook : Solutions and Examples for Java Developers

by
  • ISBN13:

    9780596001704

  • ISBN10:

    0596001703

  • Format: Paperback
  • Copyright: 2001-06-01
  • Publisher: Oreilly & Associates Inc

Note: Supplemental materials are not guaranteed with Rental or Used book purchases.

Purchase Benefits

  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $44.95 Save up to $11.24
  • Buy Used
    $33.71

    USUALLY SHIPS IN 2-4 BUSINESS DAYS

Supplemental Materials

What is included with this book?

Summary

The "Java Cookbook is a comprehensive collection of problems, solutions, and practical examples for anyone programming in Java. Developers will find hundreds of tried-and-true 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 bestselling "Perl Cookbook, covers a lot of ground, and 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 great "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

Preface xvii
Getting Started: Compiling, Running, and Debugging
1(37)
Compiling and Running Java: JDK
1(6)
Editing and Compiling with a Color-Highlighting Editor
7(1)
Compiling, Running, and Testing with an IDE
8(5)
Using Classes from This Book
13(1)
Automating Compilation with jr
14(1)
Automating Compilation with make
15(1)
Automating Compilation with Ant
16(3)
Running Applets
19(2)
Dealing with Deprecation Warnings
21(2)
Conditional Debugging without #ifdef
23(1)
Debugging Printouts
24(1)
Using a Debugger
25(3)
Unit Testing: Avoid the Need for Debuggers
28(2)
Decompiling Java Class Files
30(2)
Preventing Others from Decompiling Your Java Files
32(1)
Getting Readable Tracebacks
33(2)
Finding More Java Source Code
35(2)
Program: Debug
37(1)
Interacting with the Environment
38(15)
Getting Environment Variables
38(2)
System Properties
40(2)
Writing JDK Release-Dependent Code
42(1)
Writing Operating System-Dependent Code
43(2)
Using Classpath Effectively
45(3)
Using Extensions or Other Packaged APIs
48(1)
Parsing Command-Line Arguments
49(4)
Strings and Things
53(34)
Taking Strings Apart with Substrings
55(1)
Taking Strings Apart with String Tokenizer
56(3)
Putting Strings Together with + and StringBuffer
59(1)
Processing a String One Character at a Time
60(2)
Aligning Strings
62(2)
Converting Between Unicode Characters and Strings
64(2)
Reversing a Strings by Word or Character
66(1)
Expanding and Compressing Tabs
67(4)
Controlling Case
71(1)
Indenting Text Documents
72(2)
Entering Non-Printable Characters
74(1)
Trimming Blanks from the End of a String
75(1)
Parsing Comma-Separated Data
76(5)
Program: A Simple Text Formatter
81(2)
Program: Soundex Name Comparisons
83(4)
Pattern Matching with Regular Expressions
87(25)
Regular Expression Syntax
89(2)
How REs Work in Practice
91(2)
Using Regular Expressions in Java
93(2)
Testing REs Interactively
95(1)
Finding the Matching Text
96(1)
Replacing the Matching Text
97(1)
Printing All Occurrences of a Pattern
98(2)
Printing Lines Containing a Pattern
100(2)
Controlling Case in match () and subst()
102(1)
Precompiling the RE
102(1)
Matching Newlines in Text
103(2)
Program: Data Mining
105(2)
Program: Full Grep
107(5)
Numbers
112(37)
Checking Whether a String Is a Valid Number
114(2)
Storing a Larger Number in a Smaller
116(1)
Taking a Fraction of an Integer Without Using Floating Point
117(1)
Ensuring the Accuracy of Floating-Point Numbers
118(2)
Comparing Floating-Point Numbers
120(1)
Rounding Floating-Point Numbers
121(1)
Formatting Numbers
122(3)
Converting Between Binary, Octal, Decimal, and Hexadecimal
125(1)
Operating on a Series of Integers
126(1)
Working with Roman Numerals
127(4)
Formatting with Correct Plurals
131(2)
Generating Random Numbers
133(1)
Generating Better Random Numbers
134(1)
Calculating Trigonometric Functions
135(1)
Taking Logarithms
135(1)
Multiplying Matrixes
136(2)
Using Complex Numbers
138(2)
Handling Very Large Numbers
140(2)
Program: TempConverter
142(4)
Program: Number Palindromes
146(3)
Dates and Times
149(22)
Finding Today's Date
150(2)
Printing Date/Time in a Specified Format
152(2)
Representing Dates in Other Epochs
154(1)
Converting YMDHMS to a Calendar or Epoch Seconds
154(1)
Parsing Strings into Dates
155(2)
Converting Epoch Seconds to DMYHMS
157(1)
Adding to or Subtracting from a Date or Calendar
158(1)
Difference Between Two Dates
159(1)
Comparing Dates
160(2)
Day of Week/Month/Year or Week Number
162(1)
Calendar Page
163(3)
High-Resolution Timers
166(2)
Sleeping for a While
168(1)
Program: Reminder Service
168(3)
Structuring Data with Java
171(34)
Data Structuring Using Arrays
172(2)
Resizing an Array
174(1)
Like an Array, but More Dynamic
175(2)
Data-Independent Access with Iterators
177(1)
Structuring Data in a Linked List
178(3)
Mapping with Hashtable and HashMap
181(1)
Storing Strings in Properties and Preferences
182(3)
Sorting a Collection
185(4)
Sorting in Java 1.1
189(1)
Avoiding the Urge to Sort
190(2)
Sets
192(1)
Finding an Object in a Collection
192(3)
Converting a Collection to an Array
195(1)
Rolling Your Own Iterator
196(2)
Stack
198(1)
Multidimensional Structures
199(2)
Finally, Collections
201(1)
Program: Timing Comparisons
202(3)
Object-Oriented Techniques
205(25)
Printing Objects: Formatting with toString()
207(1)
Overriding the Equals Method
208(3)
Overriding the Hashcode Method
211(1)
The Clone Method
212(3)
The Finalize Method
215(1)
Using Inner Classes
216(1)
Providing Callbacks via Interfaces
217(4)
Polymorphism/Abstract Methods
221(1)
Passing Values
222(3)
Roll Your Own Exceptions
225(1)
Program: Plotter
226(4)
Input and Output
230(58)
Reading Standard Input
234(3)
Writing Standard Output
237(1)
Opening a File by Name
238(1)
Copying a File
239(3)
Reading a File into a String
242(1)
Reassigning the Standard Streams
243(1)
Duplicating a Stream as It Is Written
244(3)
Reading/Writing a Different Character Set
247(1)
Those Pesky End-of-Line Characters
248(1)
Beware Platform-Dependent File Code
248(2)
Reading ``Continued'' Lines
250(5)
Scanning a File
255(4)
Binary Data
259(1)
Seeking
260(1)
Writing Data Streams from C
261(2)
Saving and Restoring Serialized Objects
263(2)
Preventing ClassCastExceptions with SerialVersionUID
265(2)
Reading and Writing JAR or Zip Archives
267(3)
Reading and Writing Compressed Files
270(2)
Program: Text to PostScript
272(3)
Program: TarList (File Converter)
275(13)
Directory and Filesystem Operations
288(18)
Getting File Information
288(4)
Creating a File
292(1)
Renaming a File
293(1)
Deleting a File
293(2)
Creating a Transient File
295(1)
Changing File Attributes
296(2)
Listing a Directory
298(2)
Getting the Directory Roots
300(1)
Making New Directories
301(1)
Program: Find
302(4)
Programming Serial and Parallel Ports
306(32)
Choosing a Port
308(4)
Opening a Serial Port
312(4)
Opening a Parallel Port
316(4)
Resolving Port Conflicts
320(3)
Reading and Writing: Lock Step
323(3)
Reading and Writing: Event-Driven
326(5)
Reading and Writing: Threads
331(2)
Program: Penman Plotter
333(5)
Graphics and Sound
338(32)
Painting with a Graphics Object
339(1)
Testing Graphical Components
340(1)
Drawing Text
341(1)
Drawing Centered Text in a Component
341(2)
Drawing a Drop Shadow
343(3)
Drawing an Image
346(4)
Playing a Sound File
350(2)
Displaying a Moving Image with Video
352(3)
Drawing Text with 2D
355(3)
Printing: JDK 1.1
358(2)
Printing: Java 2
360(3)
Program: PlotterAWT
363(2)
Program: Grapher
365(5)
Graphical User Interfaces
370(45)
Displaying GUI Components
371(2)
Designing a Window Layout
373(2)
A Tabbed View of Life
375(2)
Action Handling: Making Buttons Work
377(2)
Action Handling Using Anonymous Inner Classes
379(2)
Terminating a Program with ``Window Close''
381(5)
Dialogs: When Later Just Won't Do
386(2)
Getting Program Output into a Window
388(3)
Choosing a File with JFileChooser
391(3)
Choosing a Color
394(3)
Centering a Main Window
397(1)
Changing a Swing Program's Look and Feel
398(5)
Program: Custom Font Chooser
403(5)
Program: Custom Layout Manager
408(7)
Internationalization and Localization
415(21)
Creating a Button with 118N Resources
415(2)
Listing Available Locales
417(1)
Creating a Menu with 118N Resources
418(1)
Writing Internationalization Convenience Routines
419(2)
Creating a Dialog with 118N Resources
421(2)
Creating a Resource Bundle
423(1)
JILTing Your Code
424(1)
Using a Particular Locale
424(2)
Setting the Default Locale
426(1)
Formatting Messages
427(2)
Program: MenuIntl
429(2)
Program: BusCard
431(5)
Network Clients
436(28)
Contacting a Server
438(2)
Finding and Reporting Network Addresses
440(1)
Handling Network Errors
441(1)
Reading and Writing Textual Data
442(3)
Reading and Writing Binary Data
445(2)
Reading and Writing Serialized Data
447(2)
UDP Datagrams
449(2)
Program: TFTP UDP Client
451(5)
Program: Telnet Client
456(2)
Program: Chat Client
458(6)
Server-Side Java: Sockets
464(24)
Opening a Server for Business
464(3)
Returning a Response (String or Binary)
467(4)
Returning Object Information
471(1)
Handling Multiple Clients
472(6)
Network Logging
478(4)
Program: A Java Chat Server
482(6)
Network Clients II: Applets and Web Clients
488(29)
Embedding Java in a Web Page
488(2)
Applet Techniques
490(3)
Contacting a Server on the Applet Host
493(2)
Making an Applet Show a Document
495(2)
Making an Applet Run a CGI Script
497(2)
Reading the Contents of a URL
499(1)
Extracting HTML from a URL
500(2)
Extracting URLs from a File
502(2)
Converting a Filename to a URL
504(1)
Program: MkIndex
505(4)
Program: LinkChecker
509(8)
Web Server Java: Servlets and JSP
517(47)
First Servlet: Generating an HTML Page
518(4)
Servlets: Processing Form Parameters
522(3)
Cookies
525(3)
Session Tracking
528(7)
Generating PDF from a Servlet
535(6)
HTML Meets Java: JSP
541(5)
JSP Include/Forward
546(1)
JavaServer Pages Using a Servlet
547(1)
Simplifying Your JSP with a JavaBean
548(4)
JSP Syntax Summary
552(1)
Program: CookieCutter
553(1)
Program: JabaDot Web News Portal
554(10)
Java and Electronic Mail
564(44)
Sending Email: Browser Version
565(4)
Sending Email: For Real
569(3)
Mail-Enabling a Server Program
572(6)
Sending MIME Mail
578(3)
Providing Mail Settings
581(1)
Sending Mail Without Using JavaMail
582(5)
Reading Email
587(5)
Program: MailReaderBean
592(4)
Program: MailClient
596(12)
Database Access
608(41)
Text-File Databases
609(6)
DBM Databases
615(3)
JDBC Setup and Connection
618(2)
Connecting to a JDBC Database
620(3)
Sending a JDBC Query and Getting Results
623(3)
Using JDBC Parameterized Statements
626(5)
Using Stored Procedures with JDBC
631(1)
Changing Data Using a ResultSet
631(1)
Changing Data Using SQL
632(3)
Finding JDBC Metadata
635(6)
Program: JDAdmin
641(8)
XML
649(16)
Transforming XML with XSLT
651(4)
Parsing XML with SAX
655(2)
Parsing XML with DOM
657(2)
Verifying Structure with a DTD
659(1)
Generating Your Own XML with DOM
660(2)
Program: xml2mif
662(3)
Distributed Java: RMI
665(20)
Defining the RMI Contract
667(2)
RMI Client
669(1)
RMI Server
670(2)
Deploying RMI Across a Network
672(1)
Program: RMI Callbacks
673(5)
Program: RMIWatch
678(7)
Packages and Packaging
685(27)
Creating a Package
686(1)
Documenting Classes with Javadoc
687(4)
Archiving with jar
691(1)
Running an Applet from a JAR
692(1)
Running an Applet with a JDK
692(3)
Running a Program from a JAR
695(2)
Preparing a Class as a JavaBean
697(4)
Pickling Your Bean into a JAR
701(1)
Packaging a Servlet into a WAR File
702(1)
``Write Once, Install Anywhere''
703(1)
Java Web Start
703(6)
Signing Your JAR File
709(3)
Threaded Java
712(36)
Running Code in a Different Thread
713(5)
Displaying a Moving Image with Animation
718(3)
Stopping a Thread
721(2)
Rendezvous and Timeouts
723(2)
Thread Communication: Synchronized Code
725(6)
Thread Communication: wait() and notifyAll()
731(6)
Background Saving in an Editor
737(1)
Threaded Network Server
738(10)
Introspection, or ``A Class Named Class''
748(29)
Getting a Class Descriptor
749(1)
Finding and Using Methods and Fields
750(4)
Loading and Instantiating a Class Dynamically
754(3)
Constructing a Class from Scratch
757(1)
Performance Timing
758(3)
Printing Class Information
761(2)
Program: CrossRef
763(6)
Program: AppletViewer
769(8)
Using Java with Other Languages
777(24)
Running a Program
777(4)
Running a Program and Capturing Its Output
781(3)
Mixing Java and Scripts with BSF
784(5)
Blending in Native Code (C/C++)
789(6)
Calling Java from Native Code
795(1)
Program: DBM
796(5)
Afterword 801(2)
Index 803

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Rewards Program