0%

Book Description

The revised edition of the classic Core Java™, Volume II–Advanced Features, covers advanced user-interface programming and the enterprise features of the Java SE 6 platform. Like Volume I (which covers the core language and library features), this volume has been updated for Java SE 6 and new coverage is highlighted throughout. All sample programs have been carefully crafted to illustrate the latest programming techniques, displaying best-practices solutions to the types of real-world problems professional developers encounter.

Volume II includes new sections on the StAX API, JDBC 4, compiler API, scripting framework, splash screen and tray APIs, and many other Java SE 6 enhancements. In this book, the authors focus on the more advanced features of the Java language, including complete coverage of 

  • Streams and Files

  • Networking

  • Database programming

  • XML

  • JNDI and LDAP

  • Internationalization

  • Advanced GUI components

  • Java 2D and advanced AWT

  • JavaBeans

  • Security

  • RMI and Web services

  • Collections

  • Annotations

  • Native methods

  • For thorough coverage of Java fundamentals–including interfaces and inner classes, GUI programming with Swing, exception handling, generics, collections, and concurrency–look for the eighth edition of Core Java™, Volume I–Fundamentals (ISBN: 978-0-13-235476-9).

    Table of Contents

    1. Copyright
    2. Preface
      1. To the Reader
      2. About This Book
      3. Conventions
    3. Acknowledgments
    4. 1. Streams and Files
      1. Streams
        1. Reading and Writing Bytes
        2. The Complete Stream Zoo
        3. Combining Stream Filters
      2. Text Input and Output
        1. How to Write Text Output
        2. How to Read Text Input
        3. Saving Objects in Text Format
        4. Character Sets
      3. Reading and Writing Binary Data
        1. Random-Access Files
      4. ZIP Archives
      5. Object Streams and Serialization
        1. Understanding the Object Serialization File Format
        2. Modifying the Default Serialization Mechanism
        3. Serializing Singletons and Typesafe Enumerations
        4. Versioning
        5. Using Serialization for Cloning
      6. File Management
      7. New I/O
        1. Memory-Mapped Files
        2. The Buffer Data Structure
        3. File Locking
      8. Regular Expressions
    5. 2. XML
      1. Introducing XML
        1. The Structure of an XML Document
      2. Parsing an XML Document
      3. Validating XML Documents
        1. Document Type Definitions
        2. XML Schema
        3. A Practical Example
      4. Locating Information with XPath
      5. Using Namespaces
      6. Streaming Parsers
        1. Using the SAX Parser
        2. Using the StAX Parser
      7. Generating XML Documents
        1. Writing an XML Document with StAX
      8. XSL Transformations
    6. 3. Networking
      1. Connecting to a Server
        1. Socket Timeouts
        2. Internet Addresses
      2. Implementing Servers
        1. Serving Multiple Clients
        2. Half-Close
      3. Interruptible Sockets
      4. Sending E-Mail
      5. Making URL Connections
        1. URLs and URIs
        2. Using a URLConnection to Retrieve Information
        3. Posting Form Data
    7. 4. Database Programming
      1. The Design of JDBC
        1. JDBC Driver Types
        2. Typical Uses of JDBC
      2. The Structured Query Language
      3. JDBC Configuration
        1. Database URLs
        2. Driver JAR Files
        3. Starting the Database
        4. Registering the Driver Class
        5. Connecting to the Database
      4. Executing SQL Statements
        1. Managing Connections, Statements, and Result Sets
        2. Analyzing SQL Exceptions
        3. Populating a Database
      5. Query Execution
        1. Prepared Statements
        2. Reading and Writing LOBs
        3. SQL Escapes
        4. Multiple Results
        5. Retrieving Autogenerated Keys
      6. Scrollable and Updatable Result Sets
        1. Scrollable Result Sets
        2. Updatable Result Sets
      7. Row Sets
        1. Cached Row Sets
      8. Metadata
      9. Transactions
        1. Save Points
        2. Batch Updates
        3. Advanced SQL Types
      10. Connection Management in Web and Enterprise Applications
      11. Introduction to LDAP
        1. Configuring an LDAP Server
        2. Accessing LDAP Directory Information
    8. 5. Internationalization
      1. Locales
      2. Number Formats
        1. Currencies
      3. Date and Time
      4. Collation
        1. Collation Strength
        2. Decomposition
      5. Message Formatting
        1. Choice Formats
      6. Text Files and Character Sets
        1. Character Encoding of Source Files
      7. Resource Bundles
        1. Locating Resource Bundles
        2. Property Files
        3. Bundle Classes
      8. A Complete Example
    9. 6. Advanced Swing
      1. Lists
        1. The JList Component
        2. List Models
        3. Inserting and Removing Values
        4. Rendering Values
      2. Tables
        1. A Simple Table
        2. Table Models
        3. Working with Rows and Columns
          1. Column Classes
          2. Accessing Table Columns
          3. Resizing Columns
          4. Resizing Rows
          5. Selecting Rows, Columns, and Cells
          6. Sorting Rows
          7. Filtering Rows
          8. Hiding and Displaying Columns
        4. Cell Rendering and Editing
          1. Rendering the Header
          2. Cell Editing
          3. Custom Editors
      3. Trees
        1. Simple Trees
          1. Editing Trees and Tree Paths
        2. Node Enumeration
        3. Rendering Nodes
        4. Listening to Tree Events
        5. Custom Tree Models
      4. Text Components
        1. Change Tracking in Text Components
        2. Formatted Input Fields
          1. Integer Input
          2. Behavior on Loss of Focus
          3. Filters
          4. Verifiers
          5. Other Standard Formatters
          6. Custom Formatters
        3. The JSpinner Component
        4. Displaying HTML with the JEditorPane
      5. Progress Indicators
        1. Progress Bars
        2. Progress Monitors
        3. Monitoring the Progress of Input Streams
      6. Component Organizers
        1. Split Panes
        2. Tabbed Panes
        3. Desktop Panes and Internal Frames
        4. Cascading and Tiling
        5. Vetoing Property Settings
          1. Dialogs in Internal Frames
          2. Outline Dragging
    10. 7. Advanced AWT
      1. The Rendering Pipeline
      2. Shapes
        1. Using the Shape Classes
      3. Areas
      4. Strokes
      5. Paint
      6. Coordinate Transformations
      7. Clipping
      8. Transparency and Composition
      9. Rendering Hints
      10. Readers and Writers for Images
        1. Obtaining Readers and Writers for Image File Types
        2. Reading and Writing Files with Multiple Images
      11. Image Manipulation
        1. Constructing Raster Images
        2. Filtering Images
      12. Printing
        1. Graphics Printing
        2. Multiple-Page Printing
        3. Print Preview
        4. Print Services
        5. Stream Print Services
        6. Printing Attributes
      13. The Clipboard
        1. Classes and Interfaces for Data Transfer
        2. Transferring Text
        3. The Transferable Interface and Data Flavors
        4. Building an Image Transferable
        5. Transferring Java Objects via the System Clipboard
        6. Using a Local Clipboard to Transfer Object References
      14. Drag and Drop
        1. Data Transfer Support in Swing
        2. Drag Sources
        3. Drop Targets
      15. Platform Integration
        1. Splash Screens
        2. Launching Desktop Applications
        3. The System Tray
    11. 8. JavaBeans Components
      1. Why Beans?
      2. The Bean-Writing Process
      3. Using Beans to Build an Application
        1. Packaging Beans in JAR Files
        2. Composing Beans in a Builder Environment
      4. Naming Patterns for Bean Properties and Events
      5. Bean Property Types
        1. Simple Properties
        2. Indexed Properties
        3. Bound Properties
        4. Constrained Properties
      6. BeanInfo Classes
      7. Property Editors
        1. Writing Property Editors
          1. String-Based Property Editors
          2. GUI-Based Property Editors
      8. Customizers
        1. Writing a Customizer Class
      9. JavaBeans Persistence
        1. Using JavaBeans Persistence for Arbitrary Data
          1. Writing a Persistence Delegate to Construct an Object
          2. Constructing an Object from Properties
          3. Constructing an Object with a Factory Method
          4. Postconstruction Work
          5. Transient Properties
        2. A Complete Example for JavaBeans Persistence
    12. 9. Security
      1. Class Loaders
        1. The Class Loader Hierarchy
        2. Using Class Loaders as Namespaces
        3. Writing Your Own Class Loader
      2. Bytecode Verification
      3. Security Managers and Permissions
        1. Java Platform Security
        2. Security Policy Files
        3. Custom Permissions
        4. Implementation of a Permission Class
      4. User Authentication
        1. JAAS Login Modules
      5. Digital Signatures
        1. Message Digests
        2. Message Signing
        3. The X.509 Certificate Format
        4. Verifying a Signature
        5. The Authentication Problem
        6. Certificate Signing
        7. Certificate Requests
      6. Code Signing
        1. JAR File Signing
        2. Software Developer Certificates
      7. Encryption
        1. Symmetric Ciphers
        2. Key Generation
        3. Cipher Streams
        4. Public Key Ciphers
    13. 10. Distributed Objects
      1. The Roles of Client and Server
      2. Remote Method Calls
        1. Stubs and Parameter Marshalling
      3. The RMI Programming Model
        1. Interfaces and Implementations
        2. The RMI Registry
        3. Deploying the Program
        4. Logging RMI Activity
      4. Parameters and Return Values in Remote Methods
        1. Transferring Remote Objects
        2. Transferring Nonremote Objects
        3. Dynamic Class Loading
        4. Remote References with Multiple Interfaces
        5. Remote Objects and the equals, hashCode, and clone Methods
      5. Remote Object Activation
      6. Web Services and JAX-WS
        1. Using JAX-WS
        2. A Web Service Client
        3. The Amazon E-Commerce Service
    14. 11. Scripting, Compiling, and Annotation Processing
      1. Scripting for the Java Platform
        1. Getting a Scripting Engine
        2. Script Evaluation and Bindings
        3. Redirecting Input and Output
        4. Calling Scripting Functions and Methods
        5. Compiling a Script
        6. An Example: Scripting GUI Events
      2. The Compiler API
        1. Compiling the Easy Way
        2. Using Compilation Tasks
        3. An Example: Dynamic Java Code Generation
      3. Using Annotations
        1. An Example: Annotating Event Handlers
      4. Annotation Syntax
      5. Standard Annotations
        1. Annotations for Compilation
        2. Annotations for Managing Resources
        3. Meta-Annotations
      6. Source-Level Annotation Processing
      7. Bytecode Engineering
        1. Modifying Bytecodes at Load Time
    15. 12. Native Methods
      1. Calling a C Function from a Java Program
      2. Numeric Parameters and Return Values
        1. Using printf for Formatting Numbers
      3. String Parameters
      4. Accessing Fields
        1. Accessing Instance Fields
        2. Accessing Static Fields
      5. Encoding Signatures
      6. Calling Java Methods
        1. Instance Methods
        2. Static Methods
        3. Constructors
        4. Alternative Method Invocations
      7. Accessing Array Elements
      8. Handling Errors
      9. Using the Invocation API
      10. A Complete Example: Accessing the Windows Registry
        1. Overview of the Windows Registry
        2. A Java Platform Interface for Accessing the Registry
        3. Implementation of Registry Access Functions as Native Methods
    3.138.117.53