JAVA r VOLUME II-ADVANCED FEATURES. e^i v it;



Similar documents
core. Volume I - Fundamentals Seventh Edition Sun Microsystems Press A Prentice Hall Title ULB Darmstadt

The Data Access Handbook

JAVA. EXAMPLES IN A NUTSHELL. O'REILLY 4 Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo. Third Edition.

BIRT: A Field Guide to Reporting

Java 7 Recipes. Freddy Guime. vk» (,\['«** g!p#« Carl Dea. Josh Juneau. John O'Conner

Oracle8/ SQLJ Programming

Web Development with TIBCO General Interface

IT6503 WEB PROGRAMMING. Unit-I

How To Write A Web Framework In Java

Java (12 Weeks) Introduction to Java Programming Language

Specialized Programme on Web Application Development using Open Source Tools

JAVA IN A NUTSHELL O'REILLY. David Flanagan. Fifth Edition. Beijing Cambridge Farnham Köln Sebastopol Tokyo

Building. Applications. in the Cloud. Concepts, Patterns, and Projects. AAddison-Wesley. Christopher M. Mo^ar. Cape Town Sydney.

WebSphere Training Outline

Patterns of Enterprise Application Architecture

JAVA 2 Network Security

J j enterpririse. Oracle Application Express 3. Develop Native Oracle database-centric web applications quickly and easily with Oracle APEX

Windows PowerShell Cookbook

Case Studies of Running the Platform. NetBeans UML Servlet JSP GlassFish EJB

Insight Video Net. LLC. CMS 2.0. Quick Installation Guide

C#5.0 IN A NUTSHELL. Joseph O'REILLY. Albahari and Ben Albahari. Fifth Edition. Tokyo. Sebastopol. Beijing. Cambridge. Koln.

ICE Trade Vault. Public User & Technology Guide June 6, 2014

Smooks Dev Tools Reference Guide. Version: GA

COMMUNITY COLLEGE OF CITY UNIVERSITY CITY UNIVERSITY OF HONG KONG

Applets, RMI, JDBC Exam Review

Kentico 8 Certified Developer Exam Preparation Guide. Kentico 8 Certified Developer Exam Preparation Guide

MarkLogic Server. Java Application Developer s Guide. MarkLogic 8 February, Copyright 2015 MarkLogic Corporation. All rights reserved.

Developing and Implementing Windows-Based Applications With Microsoft Visual C#.NET and Microsoft Visual Studio.NET

The end. Carl Nettelblad

Winning the Hardware-Software Game

BHARATHIAR UNIVERSITY COIMBATORE SCHOOL OF DISTANCE EDUCATION

Auditing manual. Archive Manager. Publication Date: November, 2015

JAVA ENTERPRISE IN A NUTSHELL. Jim Farley and William Crawford. O'REILLY 4 Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo.

Building Web Applications, Servlets, JSP and JDBC

Specialized Programme on Web Application Development using Open Source Tools

RFID Field Guide. Deploying Radio Frequency Identification Systems. Manish Bhuptani Shahram Moradpour. Sun Microsystems Press A Prentice Hall Title

Cocoon 2 Programming: Web Publishing with XML and Java"

Firewall Builder Architecture Overview

Java EE 7: Back-End Server Application Development

Top 10 Oracle SQL Developer Tips and Tricks

A Java-based system support for distributed applications on the Internet

IBM Operational Decision Manager Version 8 Release 5. Getting Started with Business Rules

Management. Oracle Fusion Middleware. 11 g Architecture and. Oracle Press ORACLE. Stephen Lee Gangadhar Konduri. Mc Grauu Hill.

MyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC

FileMaker 13. ODBC and JDBC Guide

Developer's Cookbook. Building Applications with. The Android. the Android SDK. A Addison-Wesley. James Steele Nelson To

Data Tool Platform SQL Development Tools

FileMaker Server 9. Custom Web Publishing with PHP

Spring Security 3. rpafktl Pen source. intruders with this easy to follow practical guide. Secure your web applications against malicious

IHS Emergency Department Dashboard

How To Use A Sas Server On A Java Computer Or A Java.Net Computer (Sas) On A Microsoft Microsoft Server (Sasa) On An Ipo (Sauge) Or A Microsas (Sask

EMC ApplicationXtender Server

Managing User Accounts

SAP Business Objects Business Intelligence platform Document Version: 4.1 Support Package Data Federation Administration Tool Guide

OLH: Oracle Loader for Hadoop OSCH: Oracle SQL Connector for Hadoop Distributed File System (HDFS)

DEPLOYMENT GUIDE Version 1.1. Deploying the BIG-IP LTM v10 with Citrix Presentation Server 4.5

EMC ApplicationXtender Server

Acronis Backup & Recovery: Events in Application Event Log of Windows

SQL Developer. User Manual. Version Copyright Jan Borchers All rights reserved.

SOA with Java. Realizing Service-Orientation with Java Technologies UPPER SADDLE RIVER, NJ BOSTON INDIANAPOLIS SAN FRANCISCO

Visual Basic. murach's TRAINING & REFERENCE

JavaFX Session Agenda

Learning HTML5 Game Programming

WEB APPLICATION DEVELOPMENT. UNIT I J2EE Platform 9

Oracle WebLogic Foundation of Oracle Fusion Middleware. Lawrence Manickam Toyork Systems Inc

EJB & J2EE. Component Technology with thanks to Jim Dowling. Components. Problems with Previous Paradigms. What EJB Accomplishes

Contents About the Contract Management Post Installation Administrator's Guide... 5 Viewing and Modifying Contract Management Settings...

Content Management Systems: Drupal Vs Jahia

Elements of Advanced Java Programming

Introducing Apache Pivot. Greg Brown, Todd Volkert 6/10/2010

Adobe Systems Incorporated

Spectrum Technology Platform. Version 9.0. Administration Guide

Extreme Java G Session 3 Main Theme Java Core Technologies (Part I) Dr. Jean-Claude Franchitti

WebLogic Server 11g Administration Handbook

Working with Indicee Elements

How To Use Query Console

Enterprise Application Development In Java with AJAX and ORM

Using LDAP Authentication in a PowerCenter Domain

Business Insight Report Authoring Getting Started Guide

Jet Data Manager 2012 User Guide

FileMaker 14. ODBC and JDBC Guide

IHS USER SECURITY AUDIT

multiple placeholders bound to one definition, 158 page approval not match author/editor rights, 157 problems with, 156 troubleshooting,

Toad for Oracle 8.6 SQL Tuning

Introduction to XML Applications

CaptainCasa. CaptainCasa Enterprise Client. CaptainCasa Enterprise Client. Feature Overview

<Insert Picture Here> What's New in NetBeans IDE 7.2

IIS 6: The Complete Reference

FileMaker Server 11. FileMaker Server Help

Enterprise Java. Where, How, When (and When Not) to Apply Java in Client/Server Business Environments. Jeffrey Savit Sean Wilcox Bhuvana Jayaraman

JAVA WEB START OVERVIEW

EMC Documentum Composer

A Java proxy for MS SQL Server Reporting Services

DEPLOYMENT GUIDE Version 1.2. Deploying the BIG-IP system v10 with Microsoft Exchange Outlook Web Access 2007

IBM Unica emessage Version 8 Release 6 February 13, User's Guide

Ficha técnica de curso Código: IFCAD320a

Transcription:

..ui. : ' :>' JAVA r VOLUME II-ADVANCED FEATURES EIGHTH EDITION 'r.", -*U'.- I' -J L."'.!'.;._ ii-.ni CAY S. HORSTMANN GARY CORNELL It.. 1 rlli!>*-<ri /.Lr:..,( i... 'I 1 U I e^i v it; HOCHSCHULE LIECHTENSTEIN PRENTICE -..., _ HALL Sun Microsystems Press...,.., r., i;,,,; Upper Saddle River, NJ Boston Indianapolis San Francisco,.. ( H(,, New York Toronto Montreal London Munich Paris Madrid ' * *" ' Capetown Sydney Tokyo Singapore Mexico City -V.

i ':^.t.-.,.j <n"\l:ills Jj Y'- *x Preface xv Acknowledgments xix 1 STREAMS AND FILES 1 Streams 2 Reading and Writing Bytes 2 The Complete Stream Zoo 4 Combining Stream Filters 8 Text Input and Output 11 How to Write Text Output 12 How to Read Text Input 14 Saving Objects in Text Format Character Sets 19 Reading and Writing Binary Data 23 Random-Access Files 26 ZIP Archives 32 14 W. VA O

Object Streams and Serialization 39 '... Understanding the Object Serialization File Format 46 Modifying the Default Serialization Mechanism 51 Serializing Singletons and Typesafe Enumerations 53 *.. Versioning 54 Using Serialization for Cloning 56 -«- ::: File Management 59 New I/O 65 Memory-Mapped Files 65 The Buffer Data Structure 72 File Locking 74 Regular Expressions 75 2 XML 87 Introducing XML 88 The Structure of an XML Document 90 Parsing an XML Document 93 Validating XML Documents 105 Document Type Definitions 106 XML Schema 112 A Practical Example 115 Locating Information with XPath 129 Using Namespaces 136 Streaming Parsers 138 Using the SAX Parser 138 Using the StAX Parser 143 - ] Generating XML Documents 146 \\v&. Writing an XML Document with StAX 150 XSL Transformations 157 3 NETWORKING 169 ;,j^i.n/-.. if.. Connecting to a Server 170 Socket Timeouts 174

r Contents Internet Addresses 175 - akiiii Implementing Servers 177. : Serving Multiple Clients 180.: i iii.=4 l * Half-Close 184. -i2 Interruptible Sockets 184 ^"?/.M. Sending E-Mail 191 Making URL Connections 196 URLs and URIs 196 Using a URLConnection to Retrieve Information 198 Posting Form Data 207 4 DATABASE PROGRAMMING 217 : The Design of JDBC 218 JDBC Driver Types 219 Typical Uses of JDBC 220 The Structured Query Language 222 JDBC Configuration 227 Database URLs 227 Driver JAR Files 228 Starting the Database 228 Registering the Driver Class 229 Connecting to the Database 229 Executing SQL Statements 232 Managing Connections, Statements, and Result Sets 235 Analyzing SQL Exceptions 236 Populating a Database 238 Query Execution 242 -i^jxsf ^ Prepared Statements 242 Reading and Writing LOBs 250 SQL Escapes 252 Multiple Results 253 Retrieving Autogenerated Keys 254 tnl

Scrollable and Updatable Result Sets 254 Scrollable Result Sets 254 Updatable Result Sets 256 Row Sets 260 Cached Row Sets 261 Metadata 263 Transactions 273 Save Points 274 Batch Updates 274 Advanced SQL Types 276 Connection Management in Web and Enterprise Applications 278 Introduction to LDAP 279 Configuring an LDAP Server 280 Accessing LDAP Directory Information 284 5 INTERNATIONALIZATION 297 Locales 298 Number Formats 303 Currencies 309 Date and Time 310 Collation 318 Collation Strength 318 Decomposition 319 Message Formatting 324 Choice Formats 326 Text Files and Character Sets 328 Character Encoding of Source Files 328 Resource Bundles 329 Locating Resource Bundles 330 Property Files 331 Bundle Classes 331 A Complete Example 333

6 ADVANCED SWING 351 TWA CIU/iAVCr Lists 352 omn,! The JList Component 352 >?qf>r List Models 358 i Inserting and Removing Values 363 Rendering Values 365 Tables 370 A Simple Table 370 Table Models 374 Working with Rows and Columns 378 Cell Rendering and Editing 392 Trees 405 Simple Trees 406 Node Enumeration 422 Rendering Nodes 424 Listening to Tree Events 427 Custom Tree Models 434 Text Components 442 Change Tracking in Text Components 443 Formatted Input Fields 447 The JSpinner Component 463 Displaying HTML with the JEditorPane 472 Progress Indicators 479 Progress Bars 479 Progress Monitors 483 Monitoring the Progress of Input Streams 487 Component Organizers 492 Split Panes 492 Tabbed Panes 496 Desktop Panes and Internal Frames 502 Cascading and Tiling 505 Vetoing Property Settings 509

7 ADVANCED AWT 521 MA 0 The Rendering Pipeline 522 'iu Shapes 524 Using the Shape Classes 527 Areas 540 Strokes 542 Paint 550 Coordinate Transformations 552 Clipping 557 Transparency and Composition 559 Rendering Hints 568 Readers and Writers for Images 575 Obtaining Readers and Writers for Image File Types 575 Reading and Writing Files with Multiple Images 576 Image Manipulation 585 Constructing Raster Images 585 Filtering Images 592 Printing 601 Graphics Printing 602 Multiple-Page Printing 611 Print Preview 613 Print Services 623 Stream Print Services 627 Printing Attributes 627 The Clipboard 635 Classes and Interfaces for Data Transfer 636 Transferring Text 636 The Transferable Interface and Data Flavors 640 Building an Image Transferable 642 Transferring Java Objects via the System Clipboard 647 Using a Local Clipboard to Transfer Object References 652

Drag and Drop 652 sha& wt' roj < hdgul*>u * Data Transfer Support in Swing 654 Drag Sources 658 Drop Targets 660 Platform Integration 668..,,,., Splash Screens 668 J *~? Launching Desktop Applications 673 The System Tray 679 8 JAVABEANS COMPONENTS 685 \ Why Beans? 686 o < The Bean-Writing Process 688.^.V, Using Beans to Build an Application 690 Vi Packaging Beans in JAR Files 691 Composing Beans in a Builder Environment 692 Naming Patterns for Bean Properties and Events 698 Bean Property Types 701 > Simple Properties 701 Indexed Properties 701 Bound Properties 702 H/\[ Constrained Properties 703 /Jto2 Beanlnfo Classes 710 Property Editors 713 Writing Property Editors 716 Customizers 723 Writing a Customizer Class 725 i JavaBeans Persistence 732 Using JavaBeans Persistence for Arbitrary Data 736 A Complete Example for JavaBeans Persistence 742 ) 9 SECURITY 755 Class Loaders 756.* fit The Class Loader Hierarchy 757..,..,,;!

Using Class Loaders as Namespaces 759 Writing Your Own Class Loader 761 Bytecode Verification 767 Security Managers and Permissions 771 Java Platform Security 772 Security Policy Files 776 Custom Permissions 783 Implementation of a Permission Class 783 User Authentication 790 JAAS Login Modules 795 Digital Signatures 805 Message Digests 805 Message Signing 812 The X.509 Certificate Format 814 Verifying a Signature 814 The Authentication Problem 818 Certificate Signing 820 Certificate Requests 821 Code Signing 822 JAR File Signing 822 Software Developer Certificates 827 Encryption 828 Symmetric Ciphers 828 Key Generation 830 Cipher Streams 834 Public Key Ciphers 835 10 DISTRIBUTED OBJECTS 841 The Roles of Client and Server 842 Remote Method Calls 845 Stubs and Parameter Marshalling 845 The RMI Programming Model 846 Interfaces and Implementations 846

r Contents The RMI Registry 848 -mia Deploying the Program 852 Logging RMI Activity 855 Parameters and Return Values in Remote Methods 856 Transferring Remote Objects 857 Transferring Nonremote Objects 857 Dynamic Class Loading 860 Remote References with Multiple Interfaces 864 Remote Objects and the equals, hashcode, and clone Methods 865 Remote Object Activation 865 Web Services and JAX-WS 871 Using JAX-WS 871 A Web Service Client 874 The Amazon E-Commerce Service 877 11 SCRIPTING, COMPILING, AND ANNOTATION PROCESSING 883 Scripting for the Java Platform 884 Getting a Scripting Engine 884 Script Evaluation and Bindings 885 Redirecting Input and Output 887 Calling Scripting Functions and Methods 888 Compiling a Script 889 An Example: Scripting GUI Events 890 The Compiler API 895 Compiling the Easy Way 895 Using Compilation Tasks 895 An Example: Dynamic Java Code Generation 900 Using Annotations 905 An Example: Annotating Event Handlers 906 Annotation Syntax 911 Standard Annotations 915

Annotations for Compilation 916 Annotations for Managing Resources 917 Meta-Annotations 917 Source-Level Annotation Processing 919 Bytecode Engineering 926 Modifying Bytecodes at Load Time 932 12 NATIVE METHODS 935 Calling a C Function from a Java Program 936 Numeric Parameters and Return Values 942 Using printf for Formatting Numbers 942 String Parameters 944 Accessing Fields 950 Accessing Instance Fields 950 Accessing Static Fields 953 Encoding Signatures 954 Calling Java Methods 956 Instance Methods 956 Static Methods 957 Constructors 958 Alternative Method Invocations 958 Accessing Array Elements 962 Handling Errors 966 Using the Invocation API 970 A Complete Example: Accessing the Windows Registry 975 Overview of the Windows Registry 975 A Java Platform Interface for Accessing the Registry 977 Implementation of Registry Access Functions as Native Methods 977 Index 991