Java Secret
Preface
About the Author
Part I-How Java Works
Chapter 1-Introducing Java SECRETS
A little knowledge can be be becom
What's in this book?
Part I: How Java Works
Part II: The Sun Classes
Part III: Platform-Dependent Java
Why Java Secrets?
Broader Applicability
More Power
Inspiration
Where Did The Secrets COME FROM?
Where is the documentation?
The Source Code
The API Documentation
What Versions of Java Are Covered?
Some Objections
Java Is Suppodosed to Be Platform INDEPENDENT
Why Aren't these Things Document?
FUD (Fear, Uncertaint, and Doub)
How secret is this, anyway?
Summary
Chapter 2-Primitive Data Types
Bytes in Memory
Variables, Values, And Identifiers
Place-Value Number Systems
Binary notation
HEXADECIMAL NOTATION
Octal Notation
INTEGERS
IntS
Long, Short, And Byte
Floating-Point Numbers
REPRESENTING FLOATING-POINT NUMBERS in Binary Code
Special Values
DENORMALIZED FLOATING-POINT NUMBERS
Charr
ASCII
ISO Latin-1
Unicode
UTF8
Boolean
Cross-Platform Issues
Byte ORDER
Unsigned integers
Integer Widths
Conversions and casting
USING a CAST
The Mechanics of Conversion
Bit-Level Operators
Some Terminology
Bitwise Operators
Bit Shift Operators
Summary
Chapter 2-Primitive Data Types
Bytes in Memory
Variables, Values, And Identifiers
Place-Value Number Systems
Binary notation
HEXADECIMAL NOTATION
Octal Notation
INTEGERS
IntS
Long, Short, And Byte
Floating-Point Numbers
REPRESENTING FLOATING-POINT NUMBERS in Binary Code
Special Values
DENORMALIZED FLOATING-POINT NUMBERS
Charr
ASCII
ISO Latin-1
Unicode
UTF8
Boolean
Cross-Platform Issues
Byte ORDER
Unsigned integers
Integer Widths
Conversions and casting
USING a CAST
The Mechanics of ConversionBit-Level Operators
Some Terminology
Bitwise Operators
Bit Shift Operators
Summary
Chapter 3-Classes, Strings, And Arrays
The Heap
Pointers, Handles, And References
What is a pointer?
What is a handle?
What is a reference?
Class Class
The Object Class
Cloning
Equality
Finalization
Runtime Type Information
Hash Codes
Threading
Strings
Arrays
Multidimensional arrays
Array Classes and Objects
System.ArrayCopy ()
Strings
String Implementation
StringBuffers
Java.util Data Structures
Vectors
Bitsets
Stack
Summary
Chapter 4-The Java Virtual Machine
Reading Compiled Files
Reading Class Files
Magic Number
Minor Version
Major Version
Constant pool
Access flags
Thisclass
Superclass
Interfaces
Attributes
Fields
Methods
Putting it all together
Import Statements
Access Specifiers
Class and superclass
Interfaces
Fields
Methods
LEGAL ISSUES
Accessing Class Files
Copying .class files
ZIP Files
Jar Files
Summary
Chapter 5-Java Byte Code
Byte Code Mnemonics
USING MNEMONICS in the disassembler
Stacks, Frames, And Pools
The opcodes
NOP
Pushing Values Onto the Stack
Stack manipulation
The Local Variable Array
Arithmetic
Bit manipulation
The Iincinc Instruction
Conversion Codes
Comparison Instructions
Unconditional Branching
Switching
Objects
Arrays
EXCEPTIONS
Type Checking
Threads: Monitorenter and MonitorExit
Decompilers and other Tools
Summary
Part Ii-the Sun classes
Chapter 6-Threads and Garbage Collection
Threads
Cooperative Versus preemptive threads
Native Versus Emulated Threads
GARBAGE COLLECTION
Reference country
Mark and Sweep
Generational Garbage Collection
Summary
Chapter 7-Controlling Applets
What is an applet?
Applets Are Components TOO
Main () Methods for Applets
INCLUDING Applets in non-applets
Dynamically Loading Applets
Stubs and context
Writing applet contexts
Writing applet stubs
Better main () Methods for applets
Loading Classes
Setting security policies
Loading Applets from Web Pages
Summary
Chapter 8-Introducing The Sun Classes
What The Sun Classes Are
Why the sun classes exist
Using the sun classes Safely
Put the classes you use on your web server
Distribute The Classes with your application
Write an Equivalent Class Class
LEGAL ISSUES
Checking for the presence of the sun classes
Checking for methods and infers
Summary
Chapter 9-Using The Sun.Applet Classes to View Applets
The sun.applet package
The appletViewer Class
The constructor
Other Methods
The appletcontext methods
The AppleTPanel and AppletViewerPanel Classes
The appletClassLoader Class
The appletsecurity class
NetWork Security
Host Security
Runtime Security
Class System Security
FILE SYSTEM Security
Support classes
AppleTaudioclip
AppletThreadGroup
AppleTCopyRight
AppleTProps
TextFrame
Summary
Chapter 10-Controlling Audio Playback with Sun.Audio
AppleTaudioclip
Audiodata
AudioPlayer
The Audio Street
AudioStream
NativeAudioStream
Audiotranslatorstream
AudiodatathAm
Continuousaudiodatathastream
AudioStreamsequence
Audiodevice
The process
Putting it all together
Summary
Chapter 11-Controlling The AWT with the sun.awt package
Aligning Objects with the sun.awt layoutmanagers
HorizbagLayout
VerticalbagLayout
VariableGridLayout
OrientableFlowLayout
FocusingTextField
Controlling Screen Updating
Summary
Chapter 12-Encoding and Decoding Data with The Sun.misc Package
Coding binary data in ASCII
The Characterencoder and CharacterDecoder Classeshexdump Encoding
Base64 encoding
Uuencoding
Ucencoding
Creating new encodings
The CRC Class
Summary
Chapter 13-Network Servers and Clients in The Sun.Net Package
Writing network servers
The sun.net.networkServer Class
Subclassing NetworkServer
Writing Network Clients
The Sun.Net.NetworkClient Class
Subclassing networkClient
TransferProtocolclient
The TransferProtocolClient Class
Subclassing TransferProtocolclient
Summary
Chapter 14-Sending Mail with the sun.net.smtp package
SMTPCLIENT
The Constructors of THE CONSTRUCTORS
The methods
EXCEPTIONS
Choosing an SMTP Server
Summary
Chapter 15-Reading News Via nntp with the sun.net.nnntp package
NewsgroupInfo
Creating newsgroupinfo objects
RESETTING ARTICLE NUMBERS
NNTPCLIENT
Opening a connection to the server
Reading Articles
Posting news
Other Commands
Summary
Chapter 16-Transferring Files with the sun.Net.ftp package
Overview of the sun.net.ftp package
The FTP Protocol
The FTPClient Class
Subclassing ftpclient
Iftpclient
Debugftpclient
FullftpClient
Summary
Chapter 17-Communicating with Web Servers
Message Formats
MessageHeader
HeaderParser
MIME TYPES
TRACKING Downloads: Metered Streams
Sun.Net.www.urlconnection
Sun.Net.www.http
HttpClient
KeepaliveCache
KeepaliveKey
ClientVector
KeepaliveStream
Sun.Net.www.httpd and the basichttpserver
Content Handlers
Text Content Handlers
The Image Content Handlers
Protocol Handlers
AppleTResource
DOC
File
FTP
gopher
HTTP
Mailto
NetDoc
The netdoc.handler class
SystemResource
Verbatim
Summary
Part III-Platform-Dependent Java
Chapter 18-Character Conversion with Sun.io
Available Conversions
Using the converters
Direct conversions
The convertall () Methodthe Convert () Method
Substitution Mode
Summary
Chapter 19-Mixed Language Programming with Native Methods
Disadvantages
Code in Java First
Profiling
Hand-Optimizing
The Java Native Method Interface
Returning Primitive Values from Native Methods
Passing Primitive Data Type Arguments to Native Methods
Using Objects in Native Methods
Invoking Instance Methods
Calling Java Methods from C
Passing arguments to java mathods
USING STRINGS in Native Methods
USING ARRAYS in Native Methods
Accessing Fields from Native Methods
StaticMethods and Fields in Native Methods
Errors and Exceptions in Native Methods
Garbage Collection and Native Methods
Threading and Native Methods
DETERMINING AT Runtime WHether Native Code Is Available
Summary
Chapter 20-Creating Stand-Alone Programs
Writing Stand-Alone Programs for UNIX
Creating Stand-Alone Programs for the Macos
The Macintosh Ddencoder Class
Using Type and CREATOR CODES
The Macintosh Runtime for Java
Creating Stand-Alone Windows Program
Summary
Appendix a
APPPENDIX B
Appendix C
Appendix D
Appendix E
Appendix f
Appendix G
Appendix H