Books & Videos

Table of Contents

  1. Chapter 1 Getting Started: Compiling, Running, and Debugging

    1. Introduction

    2. Compiling and Running Java: JDK

    3. Editing and Compiling with a Color-Highlighting Editor

    4. Compiling, Running, and Testing with an IDE

    5. Using CLASSPATH Effectively

    6. Using the com.darwinsys API Classes from This Book

    7. Compiling the Source Code Examples from This Book

    8. Automating Compilation with Ant

    9. Running Applets

    10. Dealing with Deprecation Warnings

    11. Conditional Debugging Without #ifdef

    12. Debugging Printouts

    13. Maintaining Program Correctness with Assertions

    14. Debugging with JDB

    15. Unit Testing: Avoid the Need for Debuggers

    16. Getting Readable Tracebacks

    17. Finding More Java Source Code

    18. Program: Debug

  2. Chapter 2 Interacting with the Environment

    1. Introduction

    2. Getting Environment Variables

    3. System Properties

    4. Writing JDK Release-Dependent Code

    5. Writing Operating System-Dependent Code

    6. Using Extensions or Other Packaged APIs

    7. Parsing Command-Line Arguments

  3. Chapter 3 Strings and Things

    1. Introduction

    2. Taking Strings Apart with Substrings

    3. Taking Strings Apart with StringTokenizer

    4. Putting Strings Together with +, StringBuilder (JDK 1.5), and StringBuffer

    5. Processing a String One Character at a Time

    6. Aligning Strings

    7. Converting Between Unicode Characters and Strings

    8. Reversing a String by Word or by Character

    9. Expanding and Compressing Tabs

    10. Controlling Case

    11. Indenting Text Documents

    12. Entering Nonprintable Characters

    13. Trimming Blanks from the End of a String

    14. Parsing Comma-Separated Data

    15. Program: A Simple Text Formatter

    16. Program: Soundex Name Comparisons

  4. Chapter 4 Pattern Matching with Regular Expressions

    1. Introduction

    2. Regular Expression Syntax

    3. Using regexes in Java: Test for a Pattern

    4. Finding the Matching Text

    5. Replacing the Matched Text

    6. Printing All Occurrences of a Pattern

    7. Printing Lines Containing a Pattern

    8. Controlling Case in Regular Expressions

    9. Matching "Accented" or Composite Characters

    10. Matching Newlines in Text

    11. Program: Apache Logfile Parsing

    12. Program: Data Mining

    13. Program: Full Grep

  5. Chapter 5 Numbers

    1. Introduction

    2. Checking Whether a String Is a Valid Number

    3. Storing a Larger Number in a Smaller Number

    4. Converting Numbers to Objects and Vice Versa

    5. Taking a Fraction of an Integer Without Using Floating Point

    6. Ensuring the Accuracy of Floating-Point Numbers

    7. Comparing Floating-Point Numbers

    8. Rounding Floating-Point Numbers

    9. Formatting Numbers

    10. Converting Between Binary, Octal, Decimal, and Hexadecimal

    11. Operating on a Series of Integers

    12. Working with Roman Numerals

    13. Formatting with Correct Plurals

    14. Generating Random Numbers

    15. Generating Better Random Numbers

    16. Calculating Trigonometric Functions

    17. Taking Logarithms

    18. Multiplying Matrices

    19. Using Complex Numbers

    20. Handling Very Large Numbers

    21. Program: TempConverter

    22. Program: Number Palindromes

  6. Chapter 6 Dates and Times

    1. Introduction

    2. Finding Today's Date

    3. Printing Date/Time in a Given Format

    4. Representing Dates in Other Epochs

    5. Converting YMDHMS to a Calendar or Epoch Seconds

    6. Parsing Strings into Dates

    7. Converting Epoch Seconds to DMYHMS

    8. Adding to or Subtracting from a Dateor Calendar

    9. Difference Between Two Dates

    10. Comparing Dates

    11. Day of Week/Month/Year or Week Number

    12. Creating a Calendar Page

    13. Measuring Elapsed Time

    14. Sleeping for a While

    15. Program: Reminder Service

  7. Chapter 7 Structuring Data with Java

    1. Introduction

    2. Using Arrays for Data Structuring

    3. Resizing an Array

    4. Like an Array, but More Dynamic

    5. Using Iterators for Data-Independent Access

    6. Structuring Data in a Linked List

    7. Mapping with Hashtable and HashMap

    8. Storing Strings in Properties and Preferences

    9. Sorting a Collection

    10. Avoiding the Urge to Sort

    11. Eschewing Duplication

    12. Finding an Object in a Collection

    13. Converting a Collection to an Array

    14. Rolling Your Own Iterator

    15. Stack

    16. Multidimensional Structures

    17. Finally, Collections

    18. Program: Timing Comparisons

  8. Chapter 8 Data Structuring with Generics, foreach, and Enumerations (JDK 1.5)

    1. Introduction

    2. Using Generic Collections

    3. Using "foreach" Loops

    4. Avoid Casting by Using Generics

    5. Let Java Convert with AutoBoxing and AutoUnboxing

    6. Using Typesafe Enumerations

    7. Program: MediaInvoicer

  9. Chapter 9 Object-Oriented Techniques

    1. Introduction

    2. Printing Objects: Formatting with toString( )

    3. Overriding the Equals Method

    4. Overriding the hashCode Method

    5. The Clone Method

    6. The Finalize Method

    7. Using Inner Classes

    8. Providing Callbacks via Interfaces

    9. Polymorphism/Abstract Methods

    10. Passing Values

    11. Enforcing the Singleton Pattern

    12. Roll Your Own Exceptions

    13. Program: Plotter

  10. Chapter 10 Input and Output

    1. Introduction

    2. Reading Standard Input

    3. Writing Standard Output

    4. Printing with the 1.5 Formatter

    5. Scanning a File with StreamTokenizer

    6. Scanning Input with the 1.5 Scanner Class

    7. Opening a File by Name

    8. Copying a File

    9. Reading a File into a String

    10. Reassigning the Standard Streams

    11. Duplicating a Stream as It Is Written

    12. Reading/Writing a Different Character Set

    13. Those Pesky End-of-Line Characters

    14. Beware Platform-Dependent File Code

    15. Reading "Continued" Lines

    16. Binary Data

    17. Seeking

    18. Writing Data Streams from C

    19. Saving and Restoring Java Objects

    20. Preventing ClassCastExceptions with SerialVersionUID

    21. Reading and Writing JAR or Zip Archives

    22. Reading and Writing Compressed Files

    23. Program: Text to PostScript

  11. Chapter 11 Directory and Filesystem Operations

    1. Introduction

    2. Getting File Information

    3. Creating a File

    4. Renaming a File

    5. Deleting a File

    6. Creating a Transient File

    7. Changing File Attributes

    8. Listing a Directory

    9. Getting the Directory Roots

    10. Creating New Directories

    11. Program: Find

  12. Chapter 12 Programming External Devices: Serial and Parallel Ports

    1. Introduction

    2. Choosing a Port

    3. Opening a Serial Port

    4. Opening a Parallel Port

    5. Resolving Port Conflicts

    6. Reading and Writing: Lock-Step

    7. Reading and Writing: Event-Driven

    8. Reading and Writing: Threads

    9. Program: Penman Plotter

  13. Chapter 13 Graphics and Sound

    1. Introduction

    2. Painting with a Graphics Object

    3. Testing Graphical Components

    4. Drawing Text

    5. Drawing Centered Text in a Component

    6. Drawing a Drop Shadow

    7. Drawing Text with 2D

    8. Drawing Text with an Application Font

    9. Drawing an Image

    10. Playing a Sound File

    11. Playing a Video Clip

    12. Printing in Java

    13. Program: PlotterAWT

    14. Program: Grapher

  14. Chapter 14 Graphical User Interfaces

    1. Introduction

    2. Displaying GUI Components

    3. Designing a Window Layout

    4. A Tabbed View of Life

    5. Action Handling: Making Buttons Work

    6. Action Handling Using Anonymous Inner Classes

    7. Terminating a Program with"Window Close"

    8. Dialogs: When Later Just Won't Do

    9. Catching and Formatting GUI Exceptions

    10. Getting Program Output into a Window

    11. Choosing a Value with JSpinner

    12. Choosing a File with JFileChooser

    13. Choosing a Color

    14. Formatting JComponents with HTML

    15. Centering a Main Window

    16. Changing a Swing Program's Look and Feel

    17. Enhancing Your GUI for Mac OS X

    18. Program: Custom Font Chooser

    19. Program: Custom Layout Manager

  15. Chapter 15 Internationalization and Localization

    1. Introduction

    2. Creating a Button with I18N Resources

    3. Listing Available Locales

    4. Creating a Menu with I18N Resources

    5. Writing Internationalization Convenience Routines

    6. Creating a Dialog with I18N Resources

    7. Creating a Resource Bundle

    8. Extracting Strings from Your Code

    9. Using a Particular Locale

    10. Setting the Default Locale

    11. Formatting Messages

    12. Program: MenuIntl

    13. Program: BusCard

  16. Chapter 16 Network Clients

    1. Introduction

    2. Contacting a Server

    3. Finding and Reporting Network Addresses

    4. Handling Network Errors

    5. Reading and Writing Textual Data

    6. Reading and Writing Binary Data

    7. Reading and Writing Serialized Data

    8. UDP Datagrams

    9. Program: TFTP UDP Client

    10. Program: Telnet Client

    11. Program: Chat Client

  17. Chapter 17 Server-Side Java: Sockets

    1. Introduction

    2. Opening a Server for Business

    3. Returning a Response (String or Binary)

    4. Returning Object Information

    5. Handling Multiple Clients

    6. Serving the HTTP Protocol

    7. Securing a Web Server with SSL and JSSE

    8. Network Logging

    9. Network Logging with log4j

    10. Network Logging with JDK 1.4

    11. Finding Network Interfaces

    12. Program: A Java Chat Server

  18. Chapter 18 Network Clients II: Applets and Web Clients

    1. Introduction

    2. Embedding Java in a Web Page

    3. Applet Techniques

    4. Contacting a Server on the Applet Host

    5. Making an Applet Show a Document

    6. Making an Applet Run JavaScript

    7. Making an Applet Run a CGI Script

    8. Reading the Contents of a URL

    9. URI, URL, or URN?

    10. Extracting HTML from a URL

    11. Extracting URLs from a File

    12. Converting a Filename to a URL

    13. Program: MkIndex

    14. Program: LinkChecker

  19. Chapter 19 Java and Electronic Mail

    1. Introduction

    2. Sending Email: Browser Version

    3. Sending Email: For Real

    4. Mail-Enabling a Server Program

    5. Sending MIME Mail

    6. Providing Mail Settings

    7. Sending Mail Without Using JavaMail

    8. Reading Email

    9. Program: MailReaderBean

    10. Program: MailClient

  20. Chapter 20 Database Access

    1. Introduction

    2. Easy Database Access with JDO

    3. Text-File Databases

    4. DBM Databases

    5. JDBC Setup and Connection

    6. Connecting to a JDBC Database

    7. Sending a JDBC Query and Getting Results

    8. Using JDBC Prepared Statements

    9. Using Stored Procedures with JDBC

    10. Changing Data Using a ResultSet

    11. Storing Results in a RowSet

    12. Changing Data Using SQL

    13. Finding JDBC Metadata

    14. Program: SQLRunner

  21. Chapter 21 XML

    1. Introduction

    2. Generating XML from Objects

    3. Transforming XML with XSLT

    4. Parsing XML with SAX

    5. Parsing XML with DOM

    6. Verifying Structure with a DTD

    7. Generating Your Own XML with DOM

    8. Program: xml2mif

  22. Chapter 22 Distributed Java: RMI

    1. Introduction

    2. Defining the RMI Contract

    3. Creating an RMI Client

    4. Creating an RMI Server

    5. Deploying RMI Across a Network

    6. Program: RMI Callbacks

    7. Program: NetWatch

  23. Chapter 23 Packages and Packaging

    1. Introduction

    2. Creating a Package

    3. Documenting Classes with Javadoc

    4. Beyond JavaDoc: Annotations/Metadata (JDK 1.5) and XDoclet

    5. Archiving with jar

    6. Running an Applet from a JAR

    7. Running an Applet with a Modern JDK

    8. Running a Main Program from a JAR

    9. Preparing a Class as a JavaBean

    10. Pickling Your Bean into a JAR

    11. Packaging a Servlet into a WAR File

    12. "Write Once, Install Anywhere"

    13. "Write Once, Install on Mac OS X"

    14. Java Web Start

    15. Signing Your JAR File

  24. Chapter 24 Threaded Java

    1. Introduction

    2. Running Code in a Different Thread

    3. Displaying a Moving Image with Animation

    4. Stopping a Thread

    5. Rendezvous and Timeouts

    6. Synchronizing Threads with the synchronized Keyword

    7. Simplifying Synchronization with 1.5 Locks

    8. Synchronizing Threads with wait( ) and notifyAll( )

    9. Simplifying Producer-Consumer with the 1.5 Queue Interface

    10. Background Saving in an Editor

    11. Program: Threaded Network Server

    12. Simplifying Servers Using the Concurrency Utilities (JDK 1.5)

  25. Chapter 25 Introspection, or "A Class Named Class"

    1. Introduction

    2. Getting a Class Descriptor

    3. Finding and Using Methods and Fields

    4. Loading and Instantiating a Class Dynamically

    5. Constructing a Class from Scratch

    6. Performance Timing

    7. Printing Class Information

    8. Program: CrossRef

    9. Program: AppletViewer

  26. Chapter 26 Using Java with Other Languages

    1. Introduction

    2. Running a Program

    3. Running a Program and Capturing Its Output

    4. Mixing Java and Scripts with BSF

    5. Marrying Java and Perl

    6. Blending in Native Code (C/C++)

    7. Calling Java from Native Code

    8. Program: DBM

  27. Chapter Afterword

  1. Colophon