0%

Book Description

Fully updated to reflect Java SE 7 language changes, Core Java®, Volume II—Advanced Features, Ninth Edition, is the definitive guide to Java’s most powerful features for enterprise and desktop application development.

Designed for serious programmers, this reliable, unbiased, no-nonsense tutorial illuminates advanced Java language and library features with thoroughly tested code examples. As in previous editions, all code is easy to understand and displays modern best-practice solutions to the realworld challenges faced by professional developers.

Volume II quickly brings you up-to-speed on key Java SE 7 enhancements, ranging from the new file I/O API to improved concurrency utilities. All code examples are updated to reflect these enhancements. Complete descriptions of new language and platform features are highlighted and integrated with insightful explanations of advanced Java programming techniques. You’ll learn all you need to build robust production software with 

  • Streams, files, and regular expressions

  • XML

  • Networking

  • Database programming facilities

  • JNDI/LDAP directory integration

  • Internationalization

  • Advanced Swing techniques

  • JavaBeans components

  • Web services

  • Advanced platform security features

  • Annotations

  • Distributed objects

  • Native methods, and more 

  • For detailed coverage of fundamental Java SE 7 features, including objects, classes, inheritance, interfaces, reflection, events, exceptions, graphics, Swing, generics, collections, concurrency, and debugging, look for Core Java™, Volume I—Fundamentals, Ninth Edition (ISBN-13: 978-0-13-708189-9).

    Table of Contents

    1. Title Page
    2. Copyright Page
    3. Contents
    4. Preface
      1. To the Reader
      2. About This Book
      3. Conventions
    5. Acknowledgments
    6. Chapter 1. Streams and Files
      1. 1.1. Streams
        1. 1.1.1. Reading and Writing Bytes
        2. 1.1.2. The Complete Stream Zoo
        3. 1.1.3. Combining Stream Filters
      2. 1.2. Text Input and Output
        1. 1.2.1. How to Write Text Output
        2. 1.2.2. How to Read Text Input
        3. 1.2.3. Saving Objects in Text Format
        4. 1.2.4. Character Sets
      3. 1.3. Reading and Writing Binary Data
        1. 1.3.1. Random-Access Files
      4. 1.4. ZIP Archives
      5. 1.5. Object Streams and Serialization
        1. 1.5.1. Understanding the Object Serialization File Format
        2. 1.5.2. Modifying the Default Serialization Mechanism
        3. 1.5.3. Serializing Singletons and Typesafe Enumerations
        4. 1.5.4. Versioning
        5. 1.5.5. Using Serialization for Cloning
      6. 1.6. Working with Files
        1. 1.6.1. Paths
        2. 1.6.2. Reading and Writing Files
        3. 1.6.3. Copying, Moving, and Deleting Files
        4. 1.6.4. Creating Files and Directories
        5. 1.6.5. Getting File Information
        6. 1.6.6. Iterating over the Files in a Directory
        7. 1.6.7. ZIP File Systems
      7. 1.7. Memory-Mapped Files
        1. 1.7.1. The Buffer Data Structure
        2. 1.7.2. File Locking
      8. 1.8. Regular Expressions
    7. Chapter 2. XML
      1. 2.1. Introducing XML
        1. 2.1.1. The Structure of an XML Document
      2. 2.2. Parsing an XML Document
      3. 2.3. Validating XML Documents
        1. 2.3.1. Document Type Definitions
        2. 2.3.2. XML Schema
        3. 2.3.3. A Practical Example
      4. 2.4. Locating Information with XPath
      5. 2.5. Using Namespaces
      6. 2.6. Streaming Parsers
        1. 2.6.1. Using the SAX Parser
        2. 2.6.2. Using the StAX Parser
      7. 2.7. Generating XML Documents
        1. 2.7.1. Documents without Namespaces
        2. 2.7.2. Documents with Namespaces
        3. 2.7.3. Writing Documents
        4. 2.7.4. An Example: Generating an SVG File
        5. 2.7.5. Writing an XML Document with StAX
      8. 2.8. XSL Transformations
    8. Chapter 3. Networking
      1. 3.1. Connecting to a Server
        1. 3.1.1. Socket Timeouts
        2. 3.1.2. Internet Addresses
      2. 3.2. Implementing Servers
        1. 3.2.1. Serving Multiple Clients
        2. 3.2.2. Half-Close
      3. 3.3. Interruptible Sockets
      4. 3.4. Getting Web Data
        1. 3.4.1. URLs and URIs
        2. 3.4.2. Using a URLConnection to Retrieve Information
        3. 3.4.3. Posting Form Data
      5. 3.5. Sending E-Mail
    9. Chapter 4. Database Programming
      1. 4.1. The Design of JDBC
        1. 4.1.1. JDBC Driver Types
        2. 4.1.2. Typical Uses of JDBC
      2. 4.2. The Structured Query Language
      3. 4.3. JDBC Configuration
        1. 4.3.1. Database URLs
        2. 4.3.2. Driver JAR Files
        3. 4.3.3. Starting the Database
        4. 4.3.4. Registering the Driver Class
        5. 4.3.5. Connecting to the Database
      4. 4.4. Executing SQL Statements
        1. 4.4.1. Managing Connections, Statements, and Result Sets
        2. 4.4.2. Analyzing SQL Exceptions
        3. 4.4.3. Populating a Database
      5. 4.5. Query Execution
        1. 4.5.1. Prepared Statements
        2. 4.5.2. Reading and Writing LOBs
        3. 4.5.3. SQL Escapes
        4. 4.5.4. Multiple Results
        5. 4.5.5. Retrieving Autogenerated Keys
      6. 4.6. Scrollable and Updatable Result Sets
        1. 4.6.1. Scrollable Result Sets
        2. 4.6.2. Updatable Result Sets
      7. 4.7. Row Sets
        1. 4.7.1. Constructing Row Sets
        2. 4.7.2. Cached Row Sets
      8. 4.8. Metadata
      9. 4.9. Transactions
        1. 4.9.1. Save Points
        2. 4.9.2. Batch Updates
        3. 4.9.3. Advanced SQL Types
      10. 4.10. Connection Management in Web and Enterprise Applications
    10. Chapter 5. Internationalization
      1. 5.1. Locales
      2. 5.2. Number Formats
        1. 5.2.1. Currencies
      3. 5.3. Date and Time
      4. 5.4. Collation
        1. 5.4.1. Collation Strength
        2. 5.4.2. Decomposition
      5. 5.5. Message Formatting
        1. 5.5.1. Choice Formats
      6. 5.6. Text Files and Character Sets
        1. 5.6.1. Character Encoding of Source Files
      7. 5.7. Resource Bundles
        1. 5.7.1. Locating Resource Bundles
        2. 5.7.2. Property Files
        3. 5.7.3. Bundle Classes
      8. 5.8. A Complete Example
    11. Chapter 6. Advanced Swing
      1. 6.1. Lists
        1. 6.1.1. The JList Component
        2. 6.1.2. List Models
        3. 6.1.3. Inserting and Removing Values
        4. 6.1.4. Rendering Values
      2. 6.2. Tables
        1. 6.2.1. A Simple Table
        2. 6.2.2. Table Models
        3. 6.2.3. Working with Rows and Columns
        4. 6.2.4. Cell Rendering and Editing
      3. 6.3. Trees
        1. 6.3.1. Simple Trees
        2. 6.3.2. Node Enumeration
        3. 6.3.3. Rendering Nodes
        4. 6.3.4. Listening to Tree Events
        5. 6.3.5. Custom Tree Models
      4. 6.4. Text Components
        1. 6.4.1. Change Tracking in Text Components
        2. 6.4.2. Formatted Input Fields
        3. 6.4.3. The JSpinner Component
        4. 6.4.4. Displaying HTML with the JEditorPane
      5. 6.5. Progress Indicators
        1. 6.5.1. Progress Bars
        2. 6.5.2. Progress Monitors
        3. 6.5.3. Monitoring the Progress of Input Streams
      6. 6.6. Component Organizers and Decorators
        1. 6.6.1. Split Panes
        2. 6.6.2. Tabbed Panes
        3. 6.6.3. Desktop Panes and Internal Frames
        4. 6.6.4. Cascading and Tiling
        5. 6.6.5. Vetoing Property Settings
    12. Chapter 7. Advanced AWT
      1. 7.1. The Rendering Pipeline
      2. 7.2. Shapes
        1. 7.2.1. Using the Shape Classes
      3. 7.3. Areas
      4. 7.4. Strokes
      5. 7.5. Paint
      6. 7.6. Coordinate Transformations
      7. 7.7. Clipping
      8. 7.8. Transparency and Composition
      9. 7.9. Rendering Hints
      10. 7.10. Readers and Writers for Images
        1. 7.10.1. Obtaining Readers and Writers for Image File Types
        2. 7.10.2. Reading and Writing Files with Multiple Images
      11. 7.11. Image Manipulation
        1. 7.11.1. Constructing Raster Images
        2. 7.11.2. Filtering Images
      12. 7.12. Printing
        1. 7.12.1. Graphics Printing
        2. 7.12.2. Multiple-Page Printing
        3. 7.12.3. Print Preview
        4. 7.12.4. Print Services
        5. 7.12.5. Stream Print Services
        6. 7.12.6. Printing Attributes
      13. 7.13. The Clipboard
        1. 7.13.1. Classes and Interfaces for Data Transfer
        2. 7.13.2. Transferring Text
        3. 7.13.3. The Transferable Interface and Data Flavors
        4. 7.13.4. Building an Image Transferable
        5. 7.13.5. Transferring Java Objects via the System Clipboard
        6. 7.13.6. Using a Local Clipboard to Transfer Object References
      14. 7.14. Drag and Drop
        1. 7.14.1. Data Transfer Support in Swing
        2. 7.14.2. Drag Sources
        3. 7.14.3. Drop Targets
      15. 7.15. Platform Integration
        1. 7.15.1. Splash Screens
        2. 7.15.2. Launching Desktop Applications
        3. 7.15.3. The System Tray
    13. Chapter 8. JavaBeans Components
      1. 8.1. Why Beans?
      2. 8.2. The Bean-Writing Process
      3. 8.3. Using Beans to Build an Application
        1. 8.3.1. Packaging Beans in JAR Files
        2. 8.3.2. Composing Beans in a Builder Environment
      4. 8.4. Naming Patterns for Bean Properties and Events
      5. 8.5. Bean Property Types
        1. 8.5.1. Simple Properties
        2. 8.5.2. Indexed Properties
        3. 8.5.3. Bound Properties
        4. 8.5.4. Constrained Properties
      6. 8.6. BeanInfo Classes
      7. 8.7. Property Editors
        1. 8.7.1. Writing Property Editors
      8. 8.8. Customizers
        1. 8.8.1. Writing a Customizer Class
      9. 8.9. JavaBeans Persistence
        1. 8.9.1. Using JavaBeans Persistence for Arbitrary Data
        2. 8.9.2. A Complete Example for JavaBeans Persistence
    14. Chapter 9. Security
      1. 9.1. Class Loaders
        1. 9.1.1. The Class Loader Hierarchy
        2. 9.1.2. Using Class Loaders as Namespaces
        3. 9.1.3. Writing Your Own Class Loader
      2. 9.2. Bytecode Verification
      3. 9.3. Security Managers and Permissions
        1. 9.3.1. Java Platform Security
        2. 9.3.2. Security Policy Files
        3. 9.3.3. Custom Permissions
        4. 9.3.4. Implementation of a Permission Class
      4. 9.4. User Authentication
        1. 9.4.1. JAAS Login Modules
      5. 9.5. Digital Signatures
        1. 9.5.1. Message Digests
        2. 9.5.2. Message Signing
        3. 9.5.3. Verifying a Signature
        4. 9.5.4. The Authentication Problem
        5. 9.5.5. Certificate Signing
        6. 9.5.6. Certificate Requests
      6. 9.6. Code Signing
        1. 9.6.1. JAR File Signing
        2. 9.6.2. Software Developer Certificates
      7. 9.7. Encryption
        1. 9.7.1. Symmetric Ciphers
        2. 9.7.2. Key Generation
        3. 9.7.3. Cipher Streams
        4. 9.7.4. Public Key Ciphers
    15. Chapter 10. Scripting, Compiling, and Annotation Processing
      1. 10.1. Scripting for the Java Platform
        1. 10.1.1. Getting a Scripting Engine
        2. 10.1.2. Script Evaluation and Bindings
        3. 10.1.3. Redirecting Input and Output
        4. 10.1.4. Calling Scripting Functions and Methods
        5. 10.1.5. Compiling a Script
        6. 10.1.6. An Example: Scripting GUI Events
      2. 10.2. The Compiler API
        1. 10.2.1. Compiling the Easy Way
        2. 10.2.2. Using Compilation Tasks
        3. 10.2.3. An Example: Dynamic Java Code Generation
      3. 10.3. Using Annotations
        1. 10.3.1. An Example: Annotating Event Handlers
      4. 10.4. Annotation Syntax
      5. 10.5. Standard Annotations
        1. 10.5.1. Annotations for Compilation
        2. 10.5.2. Annotations for Managing Resources
        3. 10.5.3. Meta-Annotations
      6. 10.6. Source-Level Annotation Processing
      7. 10.7. Bytecode Engineering
        1. 10.7.1. Modifying Bytecodes at Load Time
    16. Chapter 11. Distributed Objects
      1. 11.1. The Roles of Client and Server
      2. 11.2. Remote Method Calls
        1. 11.2.1. Stubs and Parameter Marshalling
      3. 11.3. The RMI Programming Model
        1. 11.3.1. Interfaces and Implementations
        2. 11.3.2. The RMI Registry
        3. 11.3.3. Deploying the Program
        4. 11.3.4. Logging RMI Activity
      4. 11.4. Parameters and Return Values in Remote Methods
        1. 11.4.1. Transferring Remote Objects
        2. 11.4.2. Transferring Nonremote Objects
        3. 11.4.3. Dynamic Class Loading
        4. 11.4.4. Remote References with Multiple Interfaces
        5. 11.4.5. Remote Objects and the equals, hashCode, and clone Methods
      5. 11.5. Remote Object Activation
    17. Chapter 12. Native Methods
      1. 12.1. Calling a C Function from a Java Program
      2. 12.2. Numeric Parameters and Return Values
        1. 12.2.1. Using printf for Formatting Numbers
      3. 12.3. String Parameters
      4. 12.4. Accessing Fields
        1. 12.4.1. Accessing Instance Fields
        2. 12.4.2. Accessing Static Fields
      5. 12.5. Encoding Signatures
      6. 12.6. Calling Java Methods
        1. 12.6.1. Instance Methods
        2. 12.6.2. Static Methods
        3. 12.6.3. Constructors
        4. 12.6.4. Alternative Method Invocations
      7. 12.7. Accessing Array Elements
      8. 12.8. Handling Errors
      9. 12.9. Using the Invocation API
      10. 12.10. A Complete Example: Accessing the Windows Registry
        1. 12.10.1. Overview of the Windows Registry
        2. 12.10.2. A Java Platform Interface for Accessing the Registry
        3. 12.10.3. Implementation of Registry Access Functions as Native Methods
    18. Index
    18.119.125.7