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 Classes from This Book

    6. Automating Compilation with jr

    7. Automating Compilation with make

    8. Automating Compilation with Ant

    9. Running Applets

    10. Dealing with Deprecation Warnings

    11. Conditional Debugging without #ifdef

    12. Debugging Printouts

    13. Using a Debugger

    14. Unit Testing: Avoid the Need for Debuggers

    15. Decompiling Java Class Files

    16. Preventing Others from Decompiling Your Java Files

    17. Getting Readable Tracebacks

    18. Finding More Java Source Code

    19. 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 CLASSPATH Effectively

    7. Using Extensions or Other Packaged APIs

    8. 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 + 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 Character

    9. Expanding and Compressing Tabs

    10. Controlling Case

    11. Indenting Text Documents

    12. Entering Non-Printable 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. How REs Work in Practice

    4. Using Regular Expressions in Java

    5. Testing REs Interactively

    6. Finding the Matching Text

    7. Replacing the Matching Text

    8. Printing All Occurrences of a Pattern

    9. Printing Lines Containing a Pattern

    10. Controlling Case in match( ) and subst( )

    11. Precompiling the RE

    12. Matching Newlines in Text

    13. Program: Data Mining

    14. 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

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

    5. Ensuring the Accuracy of Floating-Point Numbers

    6. Comparing Floating-Point Numbers

    7. Rounding Floating-Point Numbers

    8. Formatting Numbers

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

    10. Operating on a Series of Integers

    11. Working with Roman Numerals

    12. Formatting with Correct Plurals

    13. Generating Random Numbers

    14. Generating Better Random Numbers

    15. Calculating Trigonometric Functions

    16. Taking Logarithms

    17. Multiplying Matrixes

    18. Using Complex Numbers

    19. Handling Very Large Numbers

    20. Program: TempConverter

    21. Program: Number Palindromes

  6. Chapter 6 Dates and Times

    1. Introduction

    2. Finding Today’s Date

    3. Printing Date/Time in a Specified 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 Date or Calendar

    9. Difference Between Two Dates

    10. Comparing Dates

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

    12. Calendar Page

    13. High-Resolution Timers

    14. Sleeping for a While

    15. Program: Reminder Service

  7. Chapter 7 Structuring Data with Java

    1. Introduction

    2. Data Structuring Using Arrays

    3. Resizing an Array

    4. Like an Array, but More Dynamic

    5. Data-Independent Access with Iterators

    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. Sorting in Java 1.1

    11. Avoiding the Urge to Sort

    12. Sets

    13. Finding an Object in a Collection

    14. Converting a Collection to an Array

    15. Rolling Your Own Iterator

    16. Stack

    17. Multidimensional Structures

    18. Finally, Collections

    19. Program: Timing Comparisons

  8. Chapter 8 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. Roll Your Own Exceptions

    12. Program: Plotter

  9. Chapter 9 Input and Output

    1. Introduction

    2. Reading Standard Input

    3. Writing Standard Output

    4. Opening a File by Name

    5. Copying a File

    6. Reading a File into a String

    7. Reassigning the Standard Streams

    8. Duplicating a Stream as It Is Written

    9. Reading/Writing a Different Character Set

    10. Those Pesky End-of-Line Characters

    11. Beware Platform-Dependent File Code

    12. Reading “Continued” Lines

    13. Scanning a File

    14. Binary Data

    15. Seeking

    16. Writing Data Streams from C

    17. Saving and Restoring Serialized Objects

    18. Preventing ClassCastExceptions with SerialVersionUID

    19. Reading and Writing JAR or Zip Archives

    20. Reading and Writing Compressed Files

    21. Program: Text to PostScript

    22. Program: TarList (File Converter)

  10. Chapter 10 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. Making New Directories

    11. Program: Find

  11. Chapter 11 Programming 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

  12. Chapter 12 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 an Image

    8. Playing a Sound File

    9. Displaying a Moving Image with Video

    10. Drawing Text with 2D

    11. Printing: JDK 1.1

    12. Printing: Java 2

    13. Program: PlotterAWT

    14. Program: Grapher

  13. Chapter 13 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. Getting Program Output into a Window

    10. Choosing a File with JFileChooser

    11. Choosing a Color

    12. Centering a Main Window

    13. Changing a Swing Program’s Look and Feel

    14. Program: Custom Font Chooser

    15. Program: Custom Layout Manager

  14. Chapter 14 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. JILTing Your Code

    9. Using a Particular Locale

    10. Setting the Default Locale

    11. Formatting Messages

    12. Program: MenuIntl

    13. Program: BusCard

  15. Chapter 15 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

  16. Chapter 16 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. Network Logging

    7. Program: A Java Chat Server

  17. Chapter 17 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 a CGI Script

    7. Reading the Contents of a URL

    8. Extracting HTML from a URL

    9. Extracting URLs from a File

    10. Converting a Filename to a URL

    11. Program: MkIndex

    12. Program: LinkChecker

  18. Chapter 18 Web Server Java: Servlets and JSP

    1. Introduction

    2. First Servlet: Generating an HTML Page

    3. Servlets: Processing Form Parameters

    4. Cookies

    5. Session Tracking

    6. Generating PDF from a Servlet

    7. HTML Meets Java: JSP

    8. JSP Include/Forward

    9. JavaServer Pages Using a Servlet

    10. Simplifying Your JSP with a JavaBean

    11. JSP Syntax Summary

    12. Program: CookieCutter

    13. Program: JabaDot Web News Portal

  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. Text-File Databases

    3. DBM Databases

    4. JDBC Setup and Connection

    5. Connecting to a JDBC Database

    6. Sending a JDBC Query and Getting Results

    7. Using JDBC Parameterized Statements

    8. Using Stored Procedures with JDBC

    9. Changing Data Using a ResultSet

    10. Changing Data Using SQL

    11. Finding JDBC Metadata

    12. Program: JDAdmin

  21. Chapter 21 XML

    1. Introduction

    2. Transforming XML with XSLT

    3. Parsing XML with SAX

    4. Parsing XML with DOM

    5. Verifying Structure with a DTD

    6. Generating Your Own XML with DOM

    7. Program: xml2mif

  22. Chapter 22 Distributed Java: RMI

    1. Introduction

    2. Defining the RMI Contract

    3. RMI Client

    4. RMI Server

    5. Deploying RMI Across a Network

    6. Program: RMI Callbacks

    7. Program: RMIWatch

  23. Chapter 23 Packages and Packaging

    1. Introduction

    2. Creating a Package

    3. Documenting Classes with Javadoc

    4. Archiving with jar

    5. Running an Applet from a JAR

    6. Running an Applet with a JDK

    7. Running a Program from a JAR

    8. Preparing a Class as a JavaBean

    9. Pickling Your Bean into a JAR

    10. Packaging a Servlet into a WAR File

    11. “Write Once, Install Anywhere”

    12. Java Web Start

    13. 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. Thread Communication: Synchronized Code

    7. Thread Communication: wait( ) and notifyAll( )

    8. Background Saving in an Editor

    9. Threaded Network Server

  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. Blending in Native Code (C/C++)

    6. Calling Java from Native Code

    7. Program: DBM

  27. Chapter 27 Afterword

  1. Colophon