Symbols[ Top ]
== (equals), 256
| (vertical bar), 555, 583
Numbers[ Top ]
32-bit unsigned integer types, conversion for Java use, 289
A[ Top ]
absolute methods, 400
absolute URIs, 217
accept( ) method
ServerSocket class, 330-335, 338
ServerSocketChannel class, 389, 418
Activatable class, 618
addBodyPart( ) methods (Multipart class), 696
addFrom( ) method (Message class), 672
addHeader( ) method (Part interface), 686
addHeaderLine( ) method (MimePart interface), 697
addRequestProperty( ) method (URLConnection class), 516
address types, 163-167
addresses, 20, 663-667
Address class, 663
agents, 13
allocate( ) method (ByteBuffer class), 398
allocate methods (Buffer classes), 398
allocateDirect( ) method (ByteBuffer class), 399
all-routers.mcast.net, 479
anonymous ports, 327
appendMessages( ) method (Folder class), 701
Apple Macintosh support of Java, xvi
Applet .class files, storage of, 549
applets and security, 16-17
application layer, 27
ARIN (American Registry for Internet Numbers), 20
asymmetric encryption, 364
attachment( ) method (SelectionKey class), 422
Attribute class' predefined attributes, 261
attributes, 260-266
AttributeSet interface, 260
authentication
asymmetric encryption, using for, 364
HTTP authentication, URL class, 230
JavaMail API and JPasswordField from Swing, 659-661
JavaMail API and passwords, 659-663
schemes, 231
Authenticator class, 230
inherited methods, 231
requestPasswordAuthentication( ) method, 231
setDefault( ) method, 230
Authenticator class (javax.mail.Authenticator), 659
Authenticator subclass (Swing), 659
authority, 197
available( ) method (InputStream class), 74
B[ Top ]
Bcc: header information, 673
bind( ) methods
Naming class, 631
Registry interface, 634
BindException (SocketException class), 305
blocking I/O, client example, 385-389
breaksFlow( ) method (HTML.Tag class), 253
broadcasting, 471
browsers, advantages of Java versions, 554
Buffer classes, 396
absolute methods, 400
methods, 396-398
object methods, 414
subclasses, polymorphism of, 398
BufferedInputStream class, 79
BufferedOutputStream class, 79
BufferedReader and BufferedWriter classes, 96-98
buffers, 395-414
allocation, 398
buffered streams, 79-80
buffering and data transmission, 384
bulk methods, 400
clearing, 387
compacting, 406
creating, 398
data conversion, 401
direct allocation, 399
duplicating, 409
filling and draining, 399
flipping, 387
marking and resetting, 413
network programs and, 395
position, capacity, limit, and mark, 396
slicing, 413
testing code with small buffers, 408
view buffers, 404
wrapping, 399
ByteBuffer class, 392
methods for creating view buffers, 404
put( ) and get( ) methods, 400
C[ Top ]
CacheRequest subclass, 545
CacheResponse subclass, 546
caching, 35, 544-549
CallbackDigest class example, 116
CallbackDigestUserInterface class example, 117, 118
callbacks, 115-123
vs polling, 120
cancel( ) method (SelectionKey class), 422
capacity( ) method (Buffer classes), 397
case-sensitivity, xix
Cc: header information, 673
certification authorities, 365
channel classes, 415
channels, 385-395, 415-422
Channels class, 419
Channels utility class, 386
closing, 417
connecting, 415
creating, 386
input and output to, 386
reading, 416
SelectionKey class, 422
Selector class, 420
server channels, registration, 390
ServerSocketChannel class, 417-419
streams, compared to, 396
TCP channels versus datagram channels, 468
writing, 417
Channels class, 419
character encoding
detection and declaration, problems with, 201
in URLs, 208
reading and writing streams and, 91
character generator protocol (RFC 864), 385-389
ByteBuffer objects, 386
non-blocking mode, 388
chargen program, 385-389
chargen protocol handler, 571-576
chargen server, 393
CIDR (Classless Inter-Domain Routing), 32
cipher keys, 89
cipher suites, 372-374
CipherInputStream and CipherOutputStream classes, 89-91
classes of service, 302
classes, reuse and permissions, xx
clear( ) method (Buffer classes), 397
client request HTTP header configuration, 515-517
client sockets, 275-324
acquiring information about, 284-294
SocketImpl field, 284
closing, 294-297
"finally" block, 294
connections, opening and closing, 276
examples, 306-324
Finger, 306-309
Whois, 309-324
exceptions, 304
half-closed sockets, 297
local address release, management of, 302
secure sockets, creating (see secure sockets, client sockets)
setting options for, 298-302
OOBINLINE, 301
SO_KEEPALIVE, 301
SO_LINGER, 299
SO_RCVBUF, 300
SO_REUSEADDR, 302
SO_SNDBUF, 300
SO_TIMEOUT, 299
TCP_NODELAY, 298
Socket class (see Socket class)
SocketAddress class, 305
SocketException class, 304
clients
client tester, 342-346
ClientTester class, 345
InputThread class, 345
OutputThread class, 345
non-blocking I/O APIs, 385-389
sensitivity to server responses, 342
client/server model, 36-38
clone( ) method (RemoteObject class), 636
close( ) methods
DatagramChannel class, 469
DatagramSocket class, 442
Folder class, 699
ServerSocket class, 330, 336
ServerSocketChannel class, 418
Socket class, 294
SocketChannel class, 417
code examples
permissions, xx
code testing, small buffers and, 408
common log file format, 177
compact( ) method (Buffer classes), 406
compareTo( ) methods
Buffer classes, 414
URI class, 221
compressing streams, 86
included classes, 86
connect( ) methods
DatagramChannel class, 462
DatagramSocket class, 443
SocketChannel class, 415
URLConnection class, 495
ConnectException (SocketException class), 305
connection trees, 471
content handlers, 580-609
classes specialized for MIME types, 583
code examples
content handler for text/tab-separated values, 586
FITS ContentHandlerFactory, 607
FITS viewer, 608-609
TabFactory, 596
TabLoader using a ContentHandlerFactory, 597
tab-separated values ContentTester class, 589
time-content handler, 591
URLConnection for time protocol handler, 593
URLStreamHandler for time protocol handler, 594
URLTimeClient, 594
x-fits content handler, 601-605
content handler factories, installing, 597
explanation, 582-584
FITS files, description, 598-600
keywords, 599
FITS image format, for, 598-609
history, 580
MIME types and, 582
private utility methods, 587
protocol handlers and, 583
SAX2 API, 582
sequence of events, 583
tab-separated values, handler for, 585-587
using, 587-589
ContentHandler class, 581, 584-595
constructor, 584
matching objects to data, 585
return types, choosing, 590-595
ContentHandlerFactory interface, 524, 595-598
content-types.properties file, 525
CookieHandler class, 272, 274
cookies, 266-274, 516
Cookie class, 269
matches( ) method, 274
CookieHandler class, 272-274
expiration, 268
HTTP headers and, 266
Path attribute, 267
requests with multiple cookies, 269
RFC 2965, 269
security aspects of, 268
server domains and, 267
server-side use of, 266
Set-Cookie field, 266
Set-Cookie2 HTTP header, 266
$Version attribute, 267
Version attribute, 266
copyMessages( ) method (Folder class), 701
CORBA (Common Object Request Broker), 613
create( ) method (Folder class), 700
createContentHandler( ) method (ContentHandlerFactory), 583, 595
createRegistry( ) methods (LocateRegistry class), 635
createSocket( ) method (SSLSocketFactory class), 367
createURLStreamHandler( ) (URLStreamFactory interface), 577
Crypt Cabal's Cryptography FAQ, 365
D[ Top ]
data cubes, 599
data streams, 83-86
data types, 401
DatagramChannel class, 461-469
closing channels, 469
connecting, 462
opening a socket, 461
read methods, 465
receiving, 462
sending, 464
write( ) methods, 466
DatagramPacket class, 424, 425-435
constructors, 426
receiving datagrams, 427
sending datagrams, 428
get methods, 429-432
set methods, 432-435
datagrams, 24, 275, 424
datagram channels versus TCP channels, 468
DatagramPacket class and, 426
packet size, 425
size, choosing, 428
TTL (Time-To-Live) header value, 473
DatagramSocket class, 424, 435-448
connections, managing, 443-448
constructors, 435-438
sending and receiving datagrams, 438-443
socket options, 444-448
DataInputStream class, 85
readLine( ) method, problems with, 85
DataOutputStream class, 84
date: header information, 674
daytime protocol handler, 569-571
DaytimeClient, 287
deadlock, 129
DeflaterOutputStream class, 86
delete( ) method (Folder class), 701
DES/AES and RC4-based ciphers, comparison, 373
digest( ) method (DigestOuptputStream class), 88
digest streams, 88
disconnect( ) method (DatagramChannel class), 462
disconnect( ) method (DatagramSocket class), 443
DNS (Domain Name System), 29, 151, 423
domain name servers, 151
dotted quad format, 28, 150
draft standards, 39
duplicate( ) method (Buffer classes), 409
E[ Top ]
echo client, UDP implementation, 457-461
EchoClient, 292
elements, 53
email applications, 641
attachments, 683
mail providers and protocols, 643
receiving, 654-659
IMAP protocol, 656, 659
POP protocol, 654-659
protocols, comparison, 654
remote mailboxes, reading, 654
sending, 644-654
from applets, 650-654
from applications, 647-650
(see also JavaMail API)
encode( ) method (URLEncoder class), 209-212
Java 1.3 versus Java 1.4 versions, 209
encoding of characters in URLs, 208
encrypting streams, 89-91
encryption
system overhead required by, 371
encryption software, 363
(see also JSSE)
equals( ) methods
Address class, 663
Buffer classes, 414
InetAddress class, 168
NetworkInterface class, 172
RemoteObject class, 636
URI class, 221
URL class, 206
URLStreamHandler class, 561
exists( ) method (Folder class), 699
exportObject( ) methods (UnicastRemoteObject class), 617
Extensible Markup Language (see XML)
F[ Top ]
fetch( ) method (Folder class), 704
FetchProfile class, 704
fields, 585
filter streams, 67, 76-79
chaining, 76, 77
methods, 76
finger clients, 306-309
filtering of non-printable characters, 307
FingerClient, 308
FingerURLConnection class, 565-566
writing a protocol handler for, 564-567
HotJava, testing with, 567
finishConnect( ) method (SocketChannel class), 415
FITS (Flexible Image Transport System) files, 598, 598-600
keywords, 599
Flags class, 677
flip( ) method (Buffer classes), 398
flush( ) method, 71
flushing streams, 71-72
importance of, 71
Folder class, 698
information returning methods, 700
folders, 681, 698-711
checking for mail, 702
contents, listing, 702
event handling, 709
flags, 709
folder information, 700
getting messages, 703
IMAP versus POP protocol organization, 698
managing, 700
managing messages, 701
opening, 699
searching, 705-708
subscriptions, 702
utility methods, 711
fragments, 51
From: header information, 672
full-duplex connections, 276
G[ Top ]
gathers, 417
generateCharacters( ) method, 69, 70
get( ) methods
ByteBuffer class, 400
CookieHandler class, 272
GET methods, 65
URL class, 225-229
CGI and, 65
server-side input processing, 226
getAddress( ) method, 162
DatagramPacket class, 429
InetAddress class, 162
getAllByName( ) method, 156
getAllHeaderLines( ) method (MimePart interface), 697
getAllHeaders( ) method (Part interface), 687
getAllowUserInteraction( ) method, 509
getAuthority( ) method (URL class), 197
getByAddress( ) method, 157
getByInetAddress( ) method (NetworkInterface class), 171
getByName( ) method, 154-156
getByName( ) method (NetworkInterface class), 170
getCertificates( ) method (JarURLConnection class), 551
getClientHost( ) method (RemoteServer class), 637
getCodeBase( ) method (Applet class), 191, 193
getConnectTimeout( ) method (URLConnection class), 514
getContent( ) methods
ContentHandler class, 583, 585
overloaded variant, 590
Part interface, 690
URL class, 202
overloaded variant, 204
URLConnection class, 523
getContentEncoding( ) method (URLConnection class), 501
getContentID( ) method (MimePart interface), 697
getContentLanguage( ) method (MimePart interface), 698
getContentLength( ) method (URLConnection class), 499
getContentType( ) methods
Multipart class, 692
Part interface, 690
URLConnection class, 498
finger protocol, using in, 564
getCount( ) method (Multipart class), 693
getData( ) method (DatagramPacket class), 430
getDataHandler( ) method (Part interface), 690
getDate( ) method (URLConnection class), 502
getDefault( ) method (SSLSocketFactory class), 367
getDefaultAllowUserInteraction( ) method (URLConnection class, 510
getDefaultPort( ) methods
URL class, 195
URLStreamHandler class, 560
getDisposition( ) method (Part interface), 683
getDocumentBase( ) method (Applet class), 191, 193
getDoInput( ) method, 510
getDoOutput( ) method, 511
getEnabledCipherSuites( ) methods
SSLServerSocket class, 382
SSLSocket class, 372
getEnableSessionCreation( ) methods
SSLServerSocket class, 382
SSLSocket class, 375
getEncoding( ) method (MimePart interface), 697
getEventType( ) method (HyperlinkListener class), 244
getExpiration( ) method (URLConnection class), 502
getFibonacci( ) method (FibonacciImpl class), 619
getFile( ) method (URL class), 195
getFlags( ) method (Flags class), 678
getFolder( ) methods
Folder class, 699
Message class, 681
getFrom( ) method (Message class), 672
getHeader( ) methods
MimePart interface, 697
Part interface, 686
getHeaderField( ) method (URLConnection class), 504
getHost( ) method (URL class), 195
getHostAddress( ) method, 161
getHostAddress( ) methods
InetAddress class, 161
URLStreamHandler class, 560
getHostName( ) method, 160
getHostName( ) method (InetAddress class), 160
getInetAddress( ) methods
DatagramSocket class, 444
ServerSocket class, 337
Socket class, 284
getInputStream( ) methods
Part interface, 690
Socket class, 286
URLConnection class, 496
JAR archives, accessing with, 549
getInterface( ) method (MulticastSocket class), 485
getJarEntry( ) method (JarURLConnection class), 550
getJarFile( ) method (JarURLConnection class), 550
getJarFileURL( ) method (JarURLConnection class), 550
getKeepAlive( ) method (Socket class), 301
getLastModified( ) method (URLConnection class), 502
getLength( ) method (DatagramPacket class), 431
getLineCount( ) method (Part interface), 683
getLocalAddress( ) methods
DatagramSocket class, 443
Socket class, 285
getLocalHost( ) method, 157
getLocalPort( ) methods
DatagramSocket class, 442
ServerSocket class, 337
Socket class, 284
getLocalSocketAddress( ) methods
DatagramSocket class, 443
Socket class, 305
getLoopbackMode( ) method (MulticastSocket class), 487
getManifest( ) method (JarURLConnection class), 550
getMatchingHeaderLines( ) method (MimePart interface), 697
getMatchingHeaders( ) method (Part interface), 687
getMessage( ) method (Folder class), 671, 703
getMessageCount( ) method (Folder class), 702
getMessageDigest( ) method (DigestOuptputStream class), 88
getMessageNumber( ) method (Message class), 681
getMessages( ) method (Folder class), 671
getMessages( ) methods (Folder class), 704
getMode( ) method (Folder class), 700
getName( ) method (Folder class), 700
getNeedClientAuth( ) methods
SSLServerSocket class, 383
SSLSocket class, 376
getNetworkInterface( ) method (MulticastSocket class), 486
getNetworkInterfaces( ) method (NetworkInterface class), 171
getNewMessageCount( ) method (Folder class), 703
getNonMatchingHeaderLines( ) method (MimePart interface), 697
getNonMatchingHeaders( ) method (Part interface), 687
getOffset( ) method (DatagramPacket class), 431
getOOBInLine( ) method (Socket class), 302
getOutputStream( ) methods
ResponseCache class, 544
Socket class, 291
URLConnection class, 517
getParent( ) method (Folder class), 700
getPassword( ) method (JPasswordField class), 233
getPasswordAuthentication( ) method (Authenticator class), 659
getPath( ) method (URL class), 196
getPermanentFlags( ) method (Folder class), 709
getPermission( ) method (URLConnection class), 525
HttpURLConnection subclass and, 529
getPort( ) methods
DatagramPacket class, 429
DatagramSocket class, 444
Socket class, 284
URI class, 218
URL class, 195
getProtocol( ) method (URL class), 194
getQuery( ) methods
QueryString class, 212
URL class, 196
getReadTimeout( ) method (URLConnection class), 514
getReceiveBufferSize( ) method (Socket class), 300
getReceivedDate( ) method (Message class), 674
getRecipients( ) method (Message class), 673
getRef( ) method (URL class), 196
getRemoteSocketAddress( ) methods
DatagramSocket class, 444
Socket class, 305
getReplyTo( ) method (Message class), 673
getRequestProperty( ) method (URLConnection class), 516, 517
getResponseCode( ) method (Http URLConnection class), 536
getResponseMessage( ) method (HttpURLConnection class), 536
getReuseAddress( ) method (Socket class), 302
getSendBufferSize( ) method (Socket class), 300
getSentDate( ) method (Message class), 674
getSeparator( ) method (Folder class), 700
getSession( ) method (SSLSocket class), 375
getSize( ) method (Part interface), 682
getSocketAddress( ) method (DatagramPacket class), 430
getSoTimeout( ) method (ServerSocket class), 339
getStore( ) method (Folder class), 700
getSubject( ) method (Message class), 674
getSupportedCipherSuites( ) methods
SSLServerSocket class, 382
SSLSocket class, 372
getSystemResource( ) method (ClassLoader class), 193
getTcpNoDelay( ) method (Socket class), 298
getter methods (URI class), 216
getTimeToLive( ) methods
MulticastSocket class, 486
getTrafficClass( ) methods
DatagramSocket class, 447
Socket class, 302
getTTL( ) method (MulticastSocket class), 487
getType( ) methods
Address class, 663
Folder class), 700
getUnreadMessageCount( ) method (Folder class), 703
getURLName( ) method (Folder class), 700
getUseClientMode( ) method (SSLSocket class), 376
getUserInfo( ) method (URL class), 196
global multicast addresses, 164
guessContentTypeFromName( ) method (URLConnection class), 525
guessContentTypeFromStream( ) method (URLConnection class), 527
GZIPInputStream and GZIPOutputStream classes, 86
H[ Top ]
half-closing sockets, 297
handleEndTag( ) method (HTML.Tag class), 259
handles, 312
handleStartTag( ) method (HTML.Tag class), 259
HandshakeCompletedEvent class, 374
HandshakeCompletedListener interface, 374
hashCode( ) methods
Buffer classes, 414
InetAddress class, 168
NetworkInterface class, 172
RemoteObject class, 636
URI class, 221
URL class, 207
hasNewMessages( ) method (Folder class), 703
hasRemaining( ) method (Buffer classes), 398
headers, 275
header information (Message class), 671-677
HTTP headers
cache control for, 544
client request header configuration, 515
cookies and, 266
information in, 497
IP datagram headers, 24
Message class header information (JavaMail API), 671-677
MIME headers, 494
Part interface (JavaMail API), 686-689
recipient header information, 673
server restrictions on, 516
historic protocols and RFCs, 40
HostLookup application, 173-176
methods, 175
hosts, 19, 150
hostsEqual( ) method (URLStreamHandler class), 561
host-to-network layer, 23
HotJava, 306
HTML (Hypertext Markup Language), 46, 53
elements, 53
forms, 64
JEditorPane, reading with, 247
parsing, 248-266
processing with Swing (see Swing)
programmatic construction of user interfaces, 242-244
specification, problems with, 237
tags, 53
Version 3.2 and JEditorPane, 239
HTMLEditorKit.Parser class, 248-250
HTMLEditorKit.ParserCallback class, 251-253
HTML.Tag class, 253-260
breaksFlow( ) method, 253
handleEndTag( ) method, 259
handleStartTag( ) method, 259
isBlock( ) method, 253
isPreformatted( ) method, 253
mnemonic constants, 255
object constants, 256
HTTP (Hypertext Transfer Protocol), 46, 55-59
HTTP 1.1 response codes, 536
HTTP headers, 497
cache control, for, 544
client request header configuration, 515
cookies and, 266
HTTP servers (see HTTP servers)
response codes, 57-58
HTTP servers
creating with server sockets, 346-362
full-fledged server (see JHTTP server)
Redirector, 351-356
SingleFileHTTPServer, 347-351
custom servers, 346
Java, advantages for, 346
JigSaw, 347
HttpURLConnection subclass, 528-543
proxies, 542
request methods, 529
DELETE, 532
HEAD, 530
OPTIONS, 531
PUT, 532
TRACE, 533
server responses, handling, 535-542
error conditions, 540
getResponseCode( ) method, 536
getResponseMessage( ) method, 536
redirects, 540
response codes, HTTP 1.1, 536-539
response messages, 536
servers, disconnecting from, 534
streaming mode, 542
HyperlinkListener class, 244-246
Hypertext Markup Language (see HTML)
I[ Top ]
IANA, 475
ICANN (Internet Corporation for Assigned Names and Numbers), 20
IESG (Internet Engineering Steering Group), 38
IETF (Internet Engineering Task Force), 38
implAccept( ) method (ServerSocket class), 341
implementing the Runnable interface, 110
INBOX folder, 698
Inet4Address and Inet6Address classes, 169
InetAddress class, 152-169
address types and testing methods, 163-167
creating objects, 152-158
getter methods, 160-162
Object class, inheritance from, 167
object methods, 167-169
security issues, 158
subclassing, 152
testing reachability (Java 1.5), 167
UnknownHostExceptions, 157
InflaterInputStream class, 86
input streams, 67, 72-76
marking and resetting methods, 75
InputStreamReader class, 91, 95
IntBuffer class, 404
interface-local multicast addresses, 165
Internet, 31
standards, 38-45
IESG, 38
IETF, 38
public relations aspects, 45
RFCs, 38
W3C, 38
Internet address classes, 31
Internet address lookup, 150-183
code examples
finding the local machine address, 158
finding tP address of the local machine, 161
IP addresses, comparing, 168
LookupThread, 182
network interfaces, program for listing, 171
nslookup clone, 173
PooledWebLog, 180
print local machine IP address, 162
test IP address characteristics (Java 1.4), 165
using address, find the hostname, 161
web server log processing, 177
www.microsoft.com addresses printing program, 156
www.oreilly.com address printing program, 154
www.oreilly.com IP address printing program, 155
Internet addresses, 151
Internet layer, 24-26
Internet protocols
classes of service for, 302
daytime protocol (RFC 867), 286
echo protocol (RFC 862), 291
half-closing sockets for, 297
time protocol (RFC 868), 288
InternetAddress class, 663-665
protected fields, 664
I/O (input/output), 67
blocking (see blocking I/O)
non-blocking (see non-blocking I/O)
IP addresses, 28, 150
address types, 163-167
global multicast addresses, 164
interface-local multicast addresses, 165
link-local addresses, 163
loopback addresses, 163
multicast addresses, 164
organization-wide multicast addresses, 164
site-local addresses, 164
site-wide multicast addresses, 164
subnet-wide multicast addresses, 164
wildcard addresses, 163
InetAddress class, and, 152
IPv4 format, 150
IPv6 format, 150
multicast addresses, 473
non-routable addresses, 32
testing reachability (Java 1.5), 167
IP datagram headers, 24
IP (Internet Protocol), 27
broadcasting, 471
IPv4 vs. IPv6, 28
IPv6 link-local addresses, 163
IPv6 site-local addresses, 164
IRIs (Internationalized Resource Identifiers), 208
isAbsolute( ) method (URI class), 217
isAnyLocalAddress( ) method, 163
isBlock( ) method (HTML.Tag class), 253
isBound( ) methods
ServerSocket class, 336
Socket class, 296
isClosed( ) method (Socket class), 296
isConnected( ) methods
DatagramChannel class, 462
Socket class, 296
SocketChannel class, 416
isHostName( ) method, HostLookup program, 175
isInputShutdown( ) and isOutputShutdown methods (Socket class), 297
isLinkLocalAddress( ) method, 163
isLoopbackAddress method, 163
isMCGlobal( ) method, 164
isMCLinkLocal( ) method, 164
isMCNodeLocal( ) method, 165
isMCOrgLocal( ) method, 164
isMCSiteLocal( ) method, 164
isMimeType( ) method (Part interface), 690
isMulticastAddress( ) method, 164
isOpaque( ) method (URI class), 217
isOpen( ) methods
DatagramChannel class, 469
Folder class, 699
SocketChannel class, 417
isPreformatted( ) method (HTML.Tag class), 253
ISPs (Internet Service Providers), 20
isSet( ) method (Flags class), 678
isSiteLocalAddress( ) method, 164
isSubscribed( ) method (Folder class), 702
J[ Top ]
J2ME (Java 2 Micro Edition), 15
JAR archives, 549
manifest files, 550
JarURLConnection class, 549-551
methods, 550
Java, 1
case sensitivity, xix
cookie support, lack of, 230
data transmission, balancing network and CPU speed differential, 384
network-aware applications, 306
security, 16-17
supported operating systems, xvi
Swing (see Swing)
Version 1.4, xvi
Inet4Address and Inet6Address classes, 169
NetworkInterface class (see NetworkInterface class)
Version 1.5, xvi
CookieHandler class, 272
testing reachability, 167
versions, xvi
Java 2 Micro Edition (J2ME), 15
Java extension content-type mappings, 526
Java first bytes content-type mappings, 527
Java Runtime Environment, registration of security extensions, 367
Java TV API, 16
JavaBeans Activation Framework, 643
java.io package, 67-104
JavaMail API, 641-711
addresses, 663-667
Address class, 663
InternetAddress class, 663-665
NewsAddress class, 666
authentication, 659-661
code examples
applet that sends email, 651-653
graphical SMTP clients, 647-649
GUI authenticator, 660
mail client for multipart messages with attache files, 693-695
mail client that searches by From: address, 706-708
POP client that requests password as necessary, 662
program to read mail attributes, 684
program to read mail headers, 674-676, 687
program to read mailbox flags, 678-680
sending simple mail messages, 646
description, 642-644
event-based callbacke, 643
factory design pattern, 642
folders, 681, 698-711
checking for mail, 702
contents, listing, 702
event handling, 709
flags, 709
folder information, 700
getting messages, 703
managing, 700
managing messages, 701
opening, 699
searching, 705-708
subscriptions, 702
utility methods, 711
JAF (JavaBeans Activation Framework), 643
JPasswordField from Swing, 659-661
Message class, 670-681
constructors, 671
creating messages, 671
flags, 677-681
header information, 671-677
searching, 681
MIME messages, 696
multipart messages and file attachments, 692-696
Part interface, 682-692
attributes, 682-686
content, 690-692
headers, 686-689
password authentication, 659-663
sending email, 644
service providers, 642, 643
URLName class, 667-670
constructors, 667
parsing methods, 668-670
"java.net.SocketException:SSL implementation not available" error, 367
java.rmi.package, 628-634
Naming class, 629-631
remote exceptions, 632-634
Remote interface, 628
RMISecurityManager class, 632
java.rmi.registry package, 634
java.rmi.server package, 635-640
exceptions, 640
RemoteObject class, 636
RemoteServer class, 637
UnicastRemoteObject class, 638
JavaScript interpreters
Open Source Rhino, 241
JCE (Java Cryptography Extension), 89
JEditorPane class, 239-248
constructors, 239-244
HTML 3.2 and, 239
HTML user interfaces, constructing programmatically, 242-244
hyperlinks, 244-246
read( ) method, 247
Jessie, 366
JHTTP server, 356-362
main( ) method, 358
RequestProcessor class, 358
Jini, 473
joinGroup( ) method (MulticastSocket class), 480, 483
overloaded variant, 483
JPasswordField class, 232
JPasswordField component (Swing), 659-661
JSSE (Java Secure Sockets Extension), 364
event handlers, 374
JRE, requirement for multiple registrations, 367
packages, 366
registration in java.security file, 366
sessions and session management, 374
SSLSession interface, 375
supported algorithms, 372-374
K[ Top ]
keys (encryption), 89
L[ Top ]
leaveGroup( ) method (MulticastSocket class), 480, 484
Legion of the Bouncy Castle, 89
LineNumberReader class, 98
link-local addresses, 163
list( ) methods
Naming class), 629
Registry interface), 634
local caching, 35
local loopback address, 32
localhost, 32
LocalPortScanner, 328
LocateRegistry class, 634
log files (see Web server log file processing program)
lookup( ) methods
HostLookup application, 175
Naming class, 631
Registry interface, 634
lookUpNames( ) method (Whois class), 315
loopback addresses, 163
LowPortScanner, 279
M[ Top ]
mail providers and protocols, 643
main( ) methods
HostLookup program, 175
UDPPoke class, 449
manifest files, 550
man-in-the-middle attacks, 365
mark( ) methods
Buffer classes, 397, 413
InputStream class, 75
markSupported( ) method (InputStream class), 75
markup languages, 53
Marshall, Casey, 366
marshalling and unmarshalling, 617
match( ) method (Message class), 681
matches( ) method (Cookie class), 274
MBONE (Multicast Backbone on the Internet), 476
session announcements, 489
Message class, 670-681
constructors, 671
creating messages, 671
flags, 677-681
getting messages from folders, 671
header information, 671-677
date: header, 674
From: header information, 672
Reply-to: header, 672
subject: header, 674
To:, Cc:, and Bcc: headers, 673
implementation of Part interface, 670
replying to messages, 671
message integrity checking and asymmetric encryption, 364
META tags, 201
methods, protected, 493
Microsoft, Java support, xvii
MIME (Multipurpose Internet Mail Extension) types, 59-63
content handlers and, 582
content types, 60-62, 525-528
headers and protocols, 494
MIME messages, 696
x-types, 62-63
MimeMessage class, 696
MimePart interface, 696
multicast addresses, 164
multicast sockets, 470-492
clients and servers, 476
code examples
multicast sniffer, 487
MulticastSender, 490
definition, 471-473
efficiency of, 478
multicast addresses and groups, 473-476
MulticastSocket class (see MulticastSocket class)
routers and, 478
availability of, 478
routersand
multicast support by routers, 479
security issues, 480
UDP and, 471
multicasting
common permanent multicast addresses, 475-476
examples, 472, 487-492
reception by member host, 478
UDP and, 424
versus standard UDP, 477
MulticastSender class, 490-492
MulticastSniffer class, 487-490
MulticastSocket class, 479-487
communicating with multicast groups, 482-487
constructors, 480-482
Multipart class, 692
multithreading and data transmission, 384
MutableAttributeSet interface, 260-266
methods for additions and removal of attributes, 262
N[ Top ]
Nagle's algorithm, 298
Naming class, 629-631
NAT (network address translation), 33
Netscape Open Directory, 227
network layer, 24
network programming, 1
data retrieval, 2-5
data transmission, 5-6
distributed processing, 18
electronic commerce, 14
interactive television, 15
peer-to-peer interaction, 7-12
search engines, 12
servers, 12
ubiquitous computing, 15
utility, 2
(see also networks)
network programs and buffers, 395
network streams, reading, 74
networking concepts, 19
NetworkInterface class, 170-173
factory methods, 170
getter methods, 172
object methods, 172
networks, 19
data transmission speed compared to CPUs and memory, 384
fundamental applications, 610
layers, 21-27
application layer, 27
host-to-network layer, 23
Internet layer, 24-26
transport layer, 26
packet-switching, 20
protocols, 21
testing with binary data, 402
timekeeping, 288
(see also network programming)
newChannel( ) method (Channels class), 386
NewsAddress class, 666
noargs constructor (JEditorPane class), 239
nodes, 19, 150
non-blocking I/O, 384-422
Buffer classes, 396
buffering and multithreading, 384
buffers (see buffers)
ByteBuffer class, 392
Channels class, 419
channels (see channels)
Channels utility class, 386
clients, 385-389
code examples
channel-based chargen client, 387
Echo server, 407
Ingen client, 405
non-blocking chargen server, 393
non-blocking HTTP server that chunks a file, 409-412
data conversion, 401
IntBuffer class, 404
I/O APIs, 385-389
network vs. CPU speed, 384
readiness selection, 420-422
SelectionKey class, 390, 422
Selector class, 390-395, 420
servers, 389-395
ServerSocketChannel class, 389, 417-419
SocketChannel class, 415-417
non-routable addresses, 32
NoRouteToHostException (SocketException class), 305
nslookup utility, 173
O[ Top ]
object serialization, 612-613
limitations, 613
OOBINLINE socket option, 301
OP_ACCEPT, 390
open( ) methods
DatagramChannel class, 461
Folder class, 699
Selector class, 420
ServerSocketChannel class, 418
SocketChannel class, 386, 415
Open Directory interface, 228
Open Source Rhino JavaScript interpreter, 241
openConnection( ) methods
opening jar URLs (URLConnection class), 549
URL class, 201
URLStreamHandler class, 562
openStream( ) method (URL class), 199
OP_WRITE, 390
organization-wide multicast addresses, 164
output streams, 67, 68-72
flushing, 71-72
failure to, 71
OutputStreamWriter class, 91, 93, 95
P[ Top ]
packets, 20
packet-switched networks, 20
PageSaver class, 262
ParserCallback class, 251-253
parseServerAuthority( ) method (URI class), 218
parseURL( ) method (URLStreamHandler class), 557-559
Part interface, 670, 682-692
attributes, 682-686
content, 690-692
headers, 686-689
passing a reference, 614
by value, 614
remote references, 614
password authentication (JavaMail API), 659-663
PasswordAuthentication class, 232
password-protected sites, accessing, 229-236
path, 50
payloads, 275
plug-ins, 580
poke( ) method (UDPPoke class), 449
polling, 115
vs callbacks, 120
pools, 144
POP protocol, 654-659
ports, 50
anonymous ports, 327
port assignments, 29-30
port scanners, 279, 280, 295
position( ) method (Buffer classes), 396
post( ) method (URLConnection class), 522
POST method, 65
POST (URL)
CGI and, 65
predefinede attributes of the Attribute class, 261
print( ) and printin( ) methods (PrintStream class), 80
PrintStream class, 80-82
problems with, 81
PrintWriter class, 99-104
private key, 364
processes, reuse of, 106
processMultipart( ) method (Multipart class), 693
proposed standards (IETF RFCs), 39
protected fields and methods (URLConnection class), 493
protocol handlers, 493, 552-579
chargen protocol handler, 571-576
classes used for, 552
code examples
chargen Handler class, 575
ChargeURLConnection class, 574
DaytimeURLConnection class, 569
DaytimeURLStreamHandler class, 571
finger handler class, 567
FingerURLConnection class, 565
FinitInputStream, 572
SourceViewer program that sets a URLStreamHandlerFactory, 578
URLStreamHandlerFactory for finger, daytime, and chargen, 577
content handlers and, 583
daytime protocol handler, 569-571
development by Sun, 552
sequence of events in handling protocols, 556
URLStreamHandler class, 556-563
connecting method, 562-563
protecting hash code, 562
proxy server specification, 563
URL parsing methods, 557
URLStreamHandlerFactory interface, 576-579
writing, 564-567
finger protocol handler, 564-567
five baseic steps, 567
writing classes for new protocols, 554-556
protocols, 21, 50
investigating with Telnet, 276
IP (Internet Protocol), 27
IPv4 vs. IPv6, 28
reliable and unreliable, 26
TCP (transmission control protocol), 27
time protocol (RFC 868), 334
UDP (user datagram protocol), 27
proxies, 222-225
Proxy class, 223
proxy types, 223
ProxySelector class, 223-225
setting system properties, 222
proxy servers, 34-36, 222
public key encryption, 364
PushbackInputStream class, 82
methods, 82
unsupported methods, 83
PushbackReader class, 99
put( ) methods
ByteBuffer class, 400
CookieHandler class, 272, 274
ResponseCache class, 544
Q[ Top ]
query strings, 50, 65
preparations for server-side GETS, 211
QueryString class, 212
queueLength, 329
QuickTime for Java, 241
R[ Top ]
race conditions, 113
RandomPort, 337
RC4 and DES/AES-based ciphers, comparison, 373
read( ) methods
DatagramChannel class, 465
InputStream class, 72-74
JEditorPane class, 247
SocketChannel class, 416
Reader class, 94-95
methods, 94
readers, 67
readiness selection, 420-422
readLine( ) method (DataInputStream class), 85
rebind( ) methods
Naming class, 631
Registry interface, 634
receive( ) methods
DatagramChannel class, 462
DatagramSocket class, 440
ReceiverThread class, 460
recipient (To:, Cc:, and Bcc:) header information, 673
records, 585
redirection, 351
Redirector, 351-356
main( ) method, 354
multi-threading, 351
RedirectThread object, 355
run( ) method, 355
register( ) method (SelectableChannel class), 420
registries, 615
Registry interface, 634
REGISTRY_PORT field (Registry interface), 634
relative URIs, 217
relative URLs, 52
relativize( ) method (URI class), 220
reliable protocol vs. unreliable protocols, 26
remaining( ) method (Buffer classes), 398
Remote interface, 616, 628
remote objects, 611
remote references, 614
RemoteException class, 632-634
RemoteExceptions, 611
RemoteObject class, 636
RemoteServer class, 637
removeBodyPart( ) methods (Multipart class), 696
removeHeader( ) method (Part interface), 687
renameTo( ) method (Folder class), 701
Rendezvous, 473
reply( ) method (Message class), 671
Reply-to: header information, 672
requestPasswordAuthentication( ) method (Authenticator class), 231
reset( ) methods
Buffer classes, 397, 413
InputStream class, 75
resolve( ) method (URI class), 220
resolveURI( ) method (URI class), 220
response codes, HTTP 1.1, 536-539
response messages, 536
ResponseCache class, 544
ReturnDigest class, 112
rewind( ) method (Buffer classes), 397
RFCs (Requests for Comments), 38, 41-43
cookies and RFC 2965, 269
RMI (Remote Method Invocation), 610-640
classes, loading at runtime, 624-628
client side, 622
running the client, 624
code examples
applet client for the Fibonacci object, 625
database interface, 628
FibonacciApplet.html, 626
FibonacciClient, 622
FibonacciImpl class, 618
FibonacciServer class, 620
RegistryLister, 629
weather interface, 611
description, 610-616
implementation, 616-624
java.rmi.package, 628-634
Naming class, 629-631
remote exceptions, 632-634
Remote interface, 628
java.rmi.registry package, 634
LocateRegistry class, 634
Registry interface, 634
java.rmi.server package, 635-640
exceptions, 640
necessary packages, 616
object serialization, 612-613
limitations, 613
registries, 615
remote exceptions, 633
RemoteObject class, 636
RemoteServer class, 637
RMISecurityManager class, 632
server side implementation, 616-620
server startup, 621
skeleton, 615
stubs, 615
compiling, 620
UnicastRemoteObject class, 617, 638
RMISecurityManager class, 632
run( ) method (Thread class), 107
S[ Top ]
SafeBufferedReader class, 97
SafePrintWriter class, 100-104
sameFile( ) methods
URL class, 205
URLStreamHandler class, 561
saveChanges( ) method (Message class), 676
scatters, 416
schemes for authentication, 231
search( ) methods (Folder class), 705
SearchTerm class, 705
secret key encryption, 364
secure communications, 364-367
secure sockets, 363-383
client mode, 376
client sockets, 367-371
cipher suites, 372-374
connections refusal, 371
SSLSocket class, 371-376
SSLSocketFactory class, 367
utilizing, 368-371
code examples
HTTPS client, 369
SecureOrderTaker, 378-380
server sockets, 376-381
SSLServerSocket class, 376-383
security
applets and, 16-17
cookies and, 268
InetAddress class, 158
URLConnection class, considerations, 524
select( ) method (Selector class), 391
select methods (Selector class), 421
SelectableChannel class, 420
selectedKeys( ) methods
SelectionKey class, 422
Selector class, 391, 421
SelectionKey class, 390, 422
selectNow( ) method (Selector class), 421
Selector class, 390-395, 420
named bit constants, 420
send( ) methods
DatagramSocket class, 438
MulticastSocket class, 484
overloaded variant with TTL field, 485
SenderThread class, 458
sendUrgentData( ) method (Socket class), 301
server sockets, 325-362
code examples
client tester, 342-345
daytime server, 332
HTTP redirector, 351-354
HTTP server that chunks out the same file, 347-349
JHTTP web server, 356-358
look for local ports, 328
random port, 337
thread pool for handling HTTP requests, 359-362
time server, 334
manual shutdown, 334
options
setPerformancePreferences( ) method, 340
SO_RCVBUF, 340
SO_REUSEADDR, 339
SO_TIME OUT, 338
servers, 342-362
client tester, 342-346
HTTP servers, 346-362
servers
header restrictions, 516
non-blocking I/O APIs, 389-395
server-side programs, 63-66
communicating with, 225-229
reverse engineering, 226
server-side input processing, 226
ServerSocket class, 325-341
accept( ) method, 330-335, 338
accepting and closing connections, 330-336
close( ) method, 330, 336
constructors, 327-330
binding to a local IP address, 329
no-args constructor, 330, 336
queueLength, 329
getInetAddress( ) method, 337
getLocalPort( ) method, 337
getSoTimeout( ) method, 339
getter methods, 337
implAccept( ) method, 341
implementation methods, 341
IOExceptions, 328, 330
isBound( ) method, 336
object methods, 340
program lifecycle, 326
spawning of threads, 326
setPerformancePreferences( ) method, 340
SocketImplFactory, 341
ServerSocketChannel class, 326, 389, 417-419
exceptions, 419
making a channel non-blocking, 390
service providers (JavaMail API), 642
servlets, limitations of, 64
setAddress( ) method (DatagramPacket class), 433
setAllowUserInteraction( ) method, 509
setConnectTimeout( ) method (URLConnection class), 514
setContentHandlerFactory( ) method (URLConnection class), 597
setContentLanguage( ) method (MimePart interface), 698
Set-Cookie field, 266
Set-Cookie2 HTTP header, 266
setData( ) method (DatagramPacket class), 432
overloaded variant, 432
setDataHandler( ) method (Part interface), 691
setDefault( ) method (Authenticator class), 230
setDefaultAllowUserInteraction( ) method (URLConnection class), 510
setDescriptionMethod( ) (Part interface), 684
setDisposition( ) method (Part interface), 684
setDoInput( ) method, 510
setDoOutput( ) method, 511
setEnabledCipherSuites( ) methods
SSLServerSocket class, 382
SSLSocket class, 372
setEnableSessionCreation( ) method (SSLServerSocket class), 382
setFileName( ) method (Part interface), 684
setFlag( ) methods (Flags class), 678
setFlags( ) methods
Flags class, 678
Message class, 709
setFrom( ) methods
InternetAddress class, 645
Message class, 672
setHeader( ) method (Part interface), 686
setInterface( ) method (MulticastSocket class), 485
setKeepAlive( ) method (Socket class), 301
setLength( ) method (DatagramPacket class), 434
setLog( ) method (RemoteServer class), 637
setLoopback( ) method (MulticastSocket class), 487
setMessageNumber( ) method (Message class), 681
setNeedClientAuth( ) methods
SSLServerSocket class, 383
SSLSocket class, 376
setNetworkInterface( ) method (MulticastSocket class), 486
setOOBInLine( ) method (Socket class), 302
setPerformancePreferences( ) method (ServerSocket class), 340
setPort( ) method (DatagramPacket class), 434
setReadTimeout( ) method (URLConnection class), 514
setReceiveBufferSize( ) method (Socket class), 300
setRecipient( ) method (InternetAddress class), 645
setRecipients( ) method (Message class), 673
setReplyTo( ) method (Message class), 673
setRequestMethod( ) method (HttpURLConnection class), 530
setRequestProperty( ) method (URLConnection class), 515, 516
setReuseAddress( ) method (Socket class), 302
setSendBufferSize( ) method (Socket class), 300
setSentDate( ) method (Message class), 674
setSocketAddress( ) method (DatagramPacket class), 434
setSoLinger( ) method (Socket class), 299
setSoTimeout( ) method (Socket class), 300
setSubscribed( ) method (Folder class), 702
setTcpNoDelay( ) method (Socket class), 298
setText( ) methods
MimePart interface, 698
Part interface, 691
setTimeToLive( ) method (MulticastSocket class), 486
setTrafficClass( ) methods
DatagramSocket class, 447
Socket class, 302
setURL( ) method (URLStreamHandler class), 559
setUseClientMode( ) method (SSLSocket class), 376
SGML (Standard Generalized Markup Language), 53
shutdownInput( ) and shutdownOutput( ) methods (Socket class), 297
SingleFileHTTPServer, 347-351
main( ) method, 350
run( ) method, 349
site-local addresses, 164
site-wide multicast addresses, 164
skeleton, 615
skip( ) method (InputStream class), 74
SO_BROADCAST option (DatagramSocket class), 447
Socket class, 278-305
close( ) method, 294
constructors, 278-283
protected constructors, 278, 280
getter and setter methods, 298-305
isBound( ) method, 296
isClosed( ) method, 296
isConnected( ) method, 296
isInputShutdown( ) and isOutputShutdown( ) methods, 297
methods for getting information, 284-294
noargs Socket( ) constructor, 283
object methods, 304
other Java classes, relation to, 278
sendUrgentData( ) method, 301
shutdownInput( ) and shutdownOutput( ) methods, 297
SocketAddress class, 305
SocketChannel class, 415-417
open( ) method, 386
supported buffers, 406
SocketException class, 304
SocketImplFactory (ServerSocket class), 341
sockets
closing, 334
ServerSockets as opposed to Sockets, 336
code examples
command-line whois client, 313
daytime protocol client, 287
echo client, 292
getting a socket's information, 285
graphical Whois client interface, 318-323
Java command-line finger client, 308
port scanning the low 1024 ports, 279
socket closing port scanner, 295
time protocol client, 289
Whois class, 315
multicast sockets (see multicast sockets)
secure sockets (see secure sockets)
server sockets (see server sockets)
UDP datagrams and, 423-469
unicast versus multicast, 470
SO_KEEPALIVE socket option, 301
SO_LINGER socket option, 299
SO_RCVBUF option (DatagramSocket class), 445
SO_RCVBUF server socket option, 340
SO_RCVBUFsocket option, 300
SO_REUSEADDR option (DatagramSocket class), 446
SO_REUSEADDR server socket option, 339
SO_REUSEADDR socket option, 302
SO_SNDBUF option (DatagramSocket class), 446
SO_SNDBUFsocket option, 300
SO_TIME OUT server socket option, 338
SO_TIMEOUT option (DatagramSocket class), 444
SO_TIMEOUTsocket option, 299
spaces, urlencoding of, 208
special characters in URLs, 208
spiders, 12
SQLQuery( ) method, 628
SSL (Secure Sockets Layer), 364
sessions, 374
SSLServerSocket class, 376-383
getEnabledCipherSuites method, 382
getEnableSessionCreation( ) method, 382
getNeedClientAuth( ) method, 383
getSupportedCipherSuites( ) method, 382
methods, 381-383
client mode, 383
session management, 382
setEnabledCipherSuites method, 382
setEnableSessionCreation( ) method, 382
setNeedClientAuth( ) method, 383
SSLSocket class, 371-376
getEnabledCipherSuites( ) method, 372
getEnableSessionCreation( ) method, 375
getNeedClientAuth( ) method, 376
getSession( ) method, 375
getSupportedCipherSuites( ) method, 372
getUseClientMode( ) method, 376
setEnabledCipherSuites( ) method, 372
setNeedClientAuth( ) method, 376
setUseClientModel( ) method, 376
startHandshake( ) method, 375
SSLSocketFactory class, 367
createSocket( ) method, 367
getDefault( ) method, 367
Standard Generalized Markup Language (SGML), 53
startHandshake( ) method (SSLSocket class), 375
streams, 67-104, 278
buffered streams, 79-80
channels, compared to, 396
closing, 72
code examples
SafeBufferedReader class, 97
SafePrintWriter class, 100-104
compressing streams, 86
included classes, 86
data buffering, 70
data streams, 83-86
digest streams, 88
encrypting streams, 89-91
filter streams, 76-79
chaining, 76, 77
methods, 76
input streams, 72-76
marking and resetting, 75
output streams, 68-72
flushing, 71-72
PrintStream class, 80-82
problems with, 81
PushbackInputStream class, 82
readers and writers, 91-104
ASCII code and, 91
BufferedReader and BufferedWriter classes, 96-98
character encoding and, 91
filters, 95-104
InputStreamReader class, 95
OutputStreamWriter class, 93, 95
PrintWriter class, 99-104
Reader class, 94-95
SafePrintWriter class, 100-104
Writer class, 92-94
stubs, 615
compiling, 620
subject: header information, 674
subnet-wide multicast addresses, 164
Swing, 237-274
AttributeSet interface, 260
methods, 260
Authenticator subclass, 659
code examples
cookie class, 269-271
CookieHandler, 272
CookieHandler implemented on the Java Collections API, 273
Fibonacci sequence in HTML, 242
HyperlinkListener class, 245
including HTML in JLabels, 238
JEditorPane, displaying web pages with, 240
LineBreakingTagStripper, 254-255
making the getParser( ) method public, 250
Outliner, 256-259
PageSaver, 262-265
SimpleWebBrowser, 245
TagStripper, 251
cookies (see cookies)
HTML on components, 237
HTML, parsing, 248-266
HTMLEditorKit.Parser class, 248-250
HTML.Tag class, 253-260
JEditorPane (see JEditorPane class)
MutableAttributeSet class, 260-266
ParserCallback class, 251-253
symmetric key encryption, 364
synchronization, 123-129
alternatives, 128
synchronized blocks, 125-127
synchronized keywords, 125
synchronized methods, 128
synchronous input/output, 67
T[ Top ]
tab-separated values, 585
content handler for, 585-587
using, 587-589
tags, 53
TCP stack buffers, 300
TCP (Transmission Control Protocol), 27
UDP, compared to, 424
TCP/IP (Transmission Control Protocol/Internet Protocol), buffering of data, 70
TCP_NODELAY socket option, 298
Telnet, 276
Thread class, 107, 110
subclassing of, 108
run( ) method, overriding, 109
thread scheduling, 130-144
preemptive and cooperative scheduling, 132
blocking, 133
finishing, 143
joining threads, 136-138
priority-base preemption, 142
sleeping, 135-136
waiting on an object, 138-142
yielding, 134
priorities, 131
(see also threads)
threads, 105-149
advantages and disadvantages, 123
code examples
DigestListener interface, 120
DigestRunnable, 110
FileDigestThread, 108-109
GZipThread class, 145
GZipThread user interface class, 147
InstanceCallbackDigest, 118
InstanceCallbackDigestUserInterface, 119
ListCallbackDigest class, 121
ListCallbackDigestUserInterface interface, 122
LogFile, 126
preemptive scheduling thread, 143
program using accessor method to get thread output, 112
thread using accessor methods, 112
constructors and, 120
deadlock, 129
definition, 107
multithreading and data transmission, 384
returning information from, 111-123
accessor method examples, 112-113
callbacks, 115-123
polling, 115
race conditions, 113
server sockets and, 326
synchronization, 123-129
alternatives to, 128
synchronized blocks, 125-127
synchronized methods, 128
thread pools, 144-149
thread scheduling (see thread scheduling)
time protocol (RFC 868), 334
time servers, 287
TimeClient, 289
TimeServer, 334
TLS (Transport Layer Security), 364
To: header information, 673
toASCIIString( ) method (URI class), 222
toExternalForm( ) methods
URL class, 205
URLStreamHandler class, 559
toString( ) methods
Address class, 663
Buffer classes, 414
InetAddress class, 169
NetworkInterface class, 172
RemoteObject class, 636
ServerSocket class, 341
URI class, 221
URL class, 206
toURI( ) method (URL class), 206
toURL( ) method (File class), 193
transport layer, 26
TTL (Time-To-Live), 473, 477
estimated values for U.S. datagrams, 477
U[ Top ]
UDP datagrams and sockets, 423-469
code examples
DatagramPacket, constructing for receipt of data, 431
high-performance UDP discard server, 454
local UDP port scanning, 436
ReceiverThread class, 460
SenderThread class, 459
UDP daytime server, 456
UDP discard client, 439
UDP discard server, 455
UDP echo client based on channels, 466
UDP echo server, 455
UDP time client, 451
UDPDiscardServer, 441
UDPDiscardServer based on channels, 463
UDPEchoClient class, 458
UDPEchoServer based on channels, 464
UDPPoke class, 449
UDPServer class, 453
UDP (User Datagram Protocol), 27, 423-425
connections, managing, 443
DatagramChannel class, 461-469
DatagramPacket class, 425-435
datagrams, sending and receiving, 438-443
DatagramSocket class, 435-448
discard server, 441
file transfer protocols using, 424
Java classes implementing, 424
multicasting and, 424, 471
multicasting, compared to, 477
packet size, 425
ports per host, 425
simple clients, 448-452
TCP channels versus datagram channels, 468
TCP, compared to, 424
Traffic class, 447
UDP echo client, 457-461
UDPServer class, 453-457
UDPDiscardClient class, 439
UDPEchoClient class, 457
UDPPoke class, 448
private fields, 448
UDPServer class
fields, 453
unbind( ) methods
Naming class, 631
Registry interface, 634
unicast sockets, 470
UnicastRemoteObject class, 617, 638
uniform resource names (URNs), 49
unread( ) methods (PushbackInputStream class), 82
URI class, 213-222
constructing URIs, 214-216
getPort( ) method, 218
getter methods, 216
isAbsolute( ) method, 217
isOpaque( ) method, 217
parseServerAuthority( ) method, 218
resolving relative URIs, 219
relativize( ) method, 220
resolve( ) method, 220
resolveURI( ) method, 220
URL class, compared to, 214, 217
utility methods, 220
compareTo( ) method, 221
equals( )method, 221
hashCode( ) method, 221
toASCIIString( ) method, 222
toString( ) method, 221
URIs (Uniform Resource Identifiers), 46-49
absolute and relative URIs, 217
hierarchical and non-hierarchical URIs, 217
parts, 216-219
schemes, 47
URL class, 184
character encoding and, 208
constructing relative URLs, 190
constructing URLs from strings, 185
constructing URLs from thier parts, 188
constructors, 185
creating new URLs, 185-194
GET method, 225-229
server-side input processing, 226
HTTP authentication, 230
inaccessible but supported protocols, 188
methods for protocol handlers, 207
object methods, 206
equals( ), 206
hashCode( ) method, 207
toString( ) method, 206
protocol handlers, usage in, 552
retrieving data, 199-204
getContent( ) method, 202
openConnection( ) method, 201
openStream( ) method, 199
overloaded getContent( ) method, 204
server-side programs, communicating with, 225-229
reverse engineering, 226
server-side input processing, 226
splitting URLs into pieces, 194-199
getAuthority( ) method, 197
getDefaultPort( ) method, 195
getFile( ) method, 195
getHost( ) method, 195
getPath( ) method, 196
getPort( ) method, 195
getProtocol( ) method, 194
getQuery( ) method, 196
getRef( ) method, 196
getUserInfor( ) method, 196
supported protocols, 185
URI class, compared to, 214
URLConnection class, compared to, 496
URLStreamHandler objects, 192
utility methods, 205
sameFile( ) method, 205
toExternalForm( ) method, 205
toURI method, 206
URLConnection class, 493-551, 553
API, 494
caching, 544-549
client request HTTP headers, configuring, 515-517
code examples
CacheRequest class, 544
CacheResponse class, 545
CacheResponse subclass, 546
downloading and saving binaries from web sites, 499
get time of URL's last change, 530
in-memory ResponseCache, 547
posting a form, 519-521
printing URL of URLConnection to www.oreilly.com, 507
returning headers, 502
set ifModifiedSince to 24 hours ago, 512
SourceViewer with response code and message, 539
web pages, downloading with correct character sets, 498
connections, configuring, 506-515
allowUserInteraction instance field, 508
connected instance field, 508
doinput instance field, 510
doOutput instance field, 510
getter and setter methods, 506
ifModifiedSince instance field, 512
POST method versus GET for long URLs, 511
protected instance fields, 506-514
timeouts, 514
url instance field, 507
useCaches instance field, 513
constructor, 494
content handlers, 522-524
ContentHandlerFactory, 524
getContent( ) methods, 523
getContentEncoding( ) method, 501
getContentLength( ) method, 499
getContentType( ) method, 498
getDate( ) method, 502
getExpiration( ) method, 502
getHeaderField( ) method, 504
getInputStream( ) method, 496
getLastModified( ) method, 502
headers, reading, 497-506
HTTP dependency, 494
HttpURLConnection subclass (see HttpURLConnection subclass)
JarURLConnection class, 549-551
MIME content types, guessing, 525-528
object methods, 524
opening connections, 494
header querying methods, 497
reading headers, 497
retrieving arbitrary header fields, 504
servers, reading data from, 495
protocol handlers, usage in, 552
security, 524
servers, writing data to, 517-522
post( ) method, 522
POST versus GET, 517
URL class, compared to, 496
URLConnection object, 201
URLDecoder class, 213
URLEncoder class, 209-213
encode( ) method, 209-212
Java 1.3 versus Java 1.4 versions, 209
URLName class, 667-670
constructors, 667
parsing methods, 668-670
URLs and URIs, 184-236
code examples
A URL relative to the web page, 191
comparing http://www.oreilly.com/ and http://www.ora.com/, 207
download a web page, 200
downloading password-protected web pages, 235
GUI authenticator, 233-235
Open Directory searches, 229
parts of a URI, 218
parts of a URL, 197
protocol tester, 186
ProxySelectors that remember connections, 224
QueryString class, 212
-x-www-form-urlencoded strings, 210
URLs (Uniform Resource Locators), 50
character encodinging, 208
distributed computing technologies, xxi
EJB, xxi
piece-by-piece encoding, 211
relaitve URLs, 52
relative, 52
schemes, 553
IANA list, 567
structure, 194
this book, xxi
URLStreamHandler and URLStreamHandlerFactory, 207
URLStreamHandler class, 556-563
connecting method, 562-563
constructor, 557
new protocols and, 553
protecting hash code, 562
protocol handlers, usage in, 552
proxy server specification, 563
URL parsing methods, 557
URLStreamHandlerFactory interface, 576-579
protocol handlers, usage in, 553
URNs (Uniform Resource Names), 49
Usenet news and JavaMail API, 666
usernames, 50
W[ Top ]
W3C (World Wide Web Consortium), 38
levels of standards, 44
recommendations, 44-45
Web browsers
jar URLs and, 549
web concepts, 46-66
code example, form with name and email address input fields, 64
web forms, 64
Web server log file processing program, 176-183
LookupThread class, 181
processing in parallel, 183
processLogFile( ) method, 179
thread pool, 179
Whistle Blower, 641
Whois class, 315
Whois clients, 309-324
handles, 312
prefixes, 314
setting search parameters, 314
whois servers, output differences, 311
wildcard addresses, 163
working groups, 39
wrap methods (Buffer classes), 398
write( ) methods
DatagramChannel class, 466
SocketChannel class, 417
writeEntry( ) method, 127
Writer class, 92-94
writers, 67
writeTo( ) methods
Multipart class, 695
Part interface, 691
X[ Top ]
XML declarations, 201
XML (Extensible Markup Language), 54
Z[ Top ]
Zeroconf, 473
ZipInputStream and ZipOutputStream classes, 86