| Compressor | This interface models the common methods that every compressor must provide in order to be used as a "plugin" into the compression layer. | code | html |
| ContentHandlerFactory | This interface defines a factory for content handlers. | code | html |
| CookiePolicy | CookiePolicy implementations decide which cookies should be accepted and which should be rejected. | code | html |
| CookieStore | A CookieStore object represents a storage for cookie. | code | html |
| DatagramSocketImplFactory | This interface defines a factory for datagram socket implementations. | code | html |
| Decompressor | This interface models the common methods that every decompressor must provide in order to be used as a "plugin" into the decompression layer. | code | html |
| FileNameMap | A simple interface which provides a mechanism to map between a file name and a MIME type string. | code | html |
| HttpCookie.CookieAttributeAssignor | code | html | |
| InetAddressImpl | code | html | |
| Interpolator | This is the common interface of every statistical modeler, from here interpolator. | code | html |
| SocketImplFactory | This interface defines a factory for socket implementations. | code | html |
| SocketOptions | Interface of methods to get/set socket options. | code | html |
| SocksConsts | Constants used by the SOCKS protocol implementation. | code | html |
| URLStreamHandlerFactory | This interface defines a factory for URL stream
protocol handlers. |
code | html |
| AbstractPlainDatagramSocketImpl | Abstract datagram and multicast socket implementation base class. | code | html |
| AbstractPlainSocketImpl | Default Socket Implementation. | code | html |
| Authenticator | This abstract class provides a model for obtaining authentication information (in the form of a username and password) required by some network operations (such as hitting a password protected web site). | code | html |
| CacheRequest | Represents channels for storing resources in the ResponseCache. | code | html |
| CacheResponse | Represent channels for retrieving resources from the ResponseCache. | code | html |
| ContentHandler | The abstract class ContentHandler is the superclass
of all classes that read an Object from a
URLConnection. |
code | html |
| CookieHandler | A CookieHandler object provides a callback mechanism to hook up a HTTP state management policy implementation into the HTTP protocol handler. | code | html |
| DatagramSocketImpl | Abstract datagram and multicast socket implementation base class. | code | html |
| HttpURLConnection | A URLConnection with support for HTTP-specific features. | code | html |
| JarURLConnection | A URL Connection to a Java ARchive (JAR) file or an entry in a JAR file. | code | html |
| ProxySelector | Selects the proxy server to use, if any, when connecting to the network resource referenced by a URL. | code | html |
| ResponseCache | Represents implementations of URLConnection caches. | code | html |
| SecureCacheResponse | Represents a cache response originally retrieved through secure means, such as TLS. | code | html |
| SocketAddress | This class represents a Socket Address with no protocol attachment. | code | html |
| SocketImpl | The abstract class SocketImpl is a common superclass
of all classes that actually implement sockets. |
code | html |
| URLConnection | The abstract class URLConnection is the superclass
of all classes that represent a communications link between the
application and a URL. |
code | html |
| URLStreamHandler | The abstract class URLStreamHandler is the common
superclass for all stream protocol handlers. |
code | html |
| InetAddress.Cache.Type | code | html | |
| Proxy.Type | Represents the proxy type. | code | html |
| AckException | This exception is used to vehiculate the sequence number that originated the ack. | code | html |
| BindException | Signals that an error occurred while attempting to bind a socket to a local address and port. | code | html |
| ConnectException | Signals that an error occurred while attempting to connect a socket to a remote address and port. | code | html |
| Connector | This class manage the compression layer for the stream (connected) scenario. | code | html |
| CookieManager | CookieManager provides a concrete implementation of CookieHandler , which separates the storage of cookies from the policy surrounding accepting and rejecting cookies. | code | html |
| CookieManager.CookiePathComparator | code | html | |
| D | This is an utility class that provide an output method useful to print debug information. | code | html |
| DConnector | This class manage the compression layer for the datagram scenario. | code | html |
| DatagramPacket | This class represents a datagram packet. | code | html |
| DatagramSocket | This class represents a socket for sending and receiving datagram packets. | code | html |
| DefaultDatagramSocketImplFactory | This class defines a factory for creating DatagramSocketImpls. | code | html |
| DeflatingCompressor | This class is the default compressor used in our compression layer. | code | html |
| DualStackPlainDatagramSocketImpl | This class defines the plain DatagramSocketImpl that is used on Windows platforms greater than or equal to Windows Vista. | code | html |
| DualStackPlainSocketImpl | This class defines the plain SocketImpl that is used on Windows platforms greater or equal to Windows Vista. | code | html |
| FactoryURLClassLoader | code | html | |
| HttpCookie | An HttpCookie object represents an http cookie, which carries state information between server and user agent. | code | html |
| HttpRetryException | Thrown to indicate that a HTTP request needs to be retried but cannot be retried automatically, due to streaming mode being enabled. | code | html |
| IDN | Provides methods to convert internationalized domain names (IDNs) between a normal Unicode representation and an ASCII Compatible Encoding (ACE) representation. | code | html |
| Inet4Address | This class represents an Internet Protocol version 4 (IPv4) address. | code | html |
| Inet4AddressImpl | code | html | |
| Inet6Address | This class represents an Internet Protocol version 6 (IPv6) address. | code | html |
| Inet6AddressImpl | code | html | |
| InetAddress | This class represents an Internet Protocol (IP) address. | code | html |
| InetAddress.Cache | A cache that manages entries based on a policy specified at creation time. | code | html |
| InetAddress.CacheEntry | Represents a cache entry | code | html |
| InetAddressContainer | code | html | |
| InetAddressImplFactory | code | html | |
| InetSocketAddress | This class implements an IP Socket Address (IP address + port number) It can also be a pair (hostname + port number), in which case an attempt will be made to resolve the hostname. | code | html |
| InflatingDecompressor | This class is the default decompressor used in our compression layer. | code | html |
| InterfaceAddress | This class represents a Network Interface address. | code | html |
| LinearInterpolator | This class is an implementation of the Interpolator interface and it uses a statistical approach called fixed point interpolation that I created during my master degree thesis. | code | html |
| Listener | This class represents the two separate half parts of the measurement process upon which is based the statistical model used to drive the compression layer. | code | html |
| MalformedURLException | Thrown to indicate that a malformed URL has occurred. | code | html |
| MimeTypeMapper | This non-public class is used to implement the FileNameMap interface which defines a mechanism for mapping filenames to MIME types. | code | html |
| MulticastSocket | The multicast datagram socket class is useful for sending and receiving IP multicast packets. | code | html |
| NetPermission | This class is for various network permissions. | code | html |
| NetworkInterface | This class represents a Network Interface made up of a name, and a list of IP addresses assigned to this interface. | code | html |
| NoMagicException | This exception is thrown by ZObject when it cannot recognize the type of the packet because it cannot find the canonical signature (magic sequence). | code | html |
| NoRouteToHostException | Signals that an error occurred while attempting to connect a socket to a remote address and port. | code | html |
| Parts | code | html | |
| PasswordAuthentication | The class PasswordAuthentication is a data holder that is used by Authenticator. | code | html |
| PlainDatagramSocketImpl | code | html | |
| PlainSocketImpl | code | html | |
| PortUnreachableException | Signals that an ICMP Port Unreachable message has been received on a connected datagram. | code | html |
| ProtocolException | Thrown to indicate that there is an error in the underlying protocol, such as a TCP error. | code | html |
| Proxy | This class represents a proxy setting, typically a type (http, socks) and a socket address. | code | html |
| ServerSocket | This class implements server sockets. | code | html |
| Socket | This class implements client sockets (also called just "sockets"). | code | html |
| SocketException | Thrown to indicate that there is an error creating or accessing a Socket. | code | html |
| SocketInputStream | This stream extends FileInputStream to implement a SocketInputStream. | code | html |
| SocketOutputStream | This stream extends FileOutputStream to implement a SocketOutputStream. | code | html |
| SocketPermission | This class represents access to a network via sockets. | code | html |
| SocketPermissionCollection | if (init'd with IP, key is IP as string) if wildcard, its the wild card else its the cname? | code | html |
| SocketTimeoutException | Signals that a timeout has occurred on a socket read or accept. | code | html |
| SocksSocketImpl | SOCKS (V4 & V5) TCP socket implementation (RFC 1928). | code | html |
| TwoStacksPlainDatagramSocketImpl | This class defines the plain DatagramSocketImpl that is used for all Windows versions lower than Vista. | code | html |
| TwoStacksPlainSocketImpl | code | html | |
| URI | Represents a Uniform Resource Identifier (URI) reference. | code | html |
| URI.Parser | code | html | |
| URISyntaxException | Checked exception thrown to indicate that a string could not be parsed as a URI reference. | code | html |
| URL | Class URL represents a Uniform Resource
Locator, a pointer to a "resource" on the World
Wide Web. |
code | html |
| URLClassLoader | This class loader is used to load classes and resources from a search path of URLs referring to both JAR files and directories. | code | html |
| URLDecoder | Utility class for HTML form decoding. | code | html |
| URLEncoder | Utility class for HTML form encoding. | code | html |
| UnknownContentHandler | code | html | |
| UnknownHostException | Thrown to indicate that the IP address of a host could not be determined. | code | html |
| UnknownServiceException | Thrown to indicate that an unknown service exception has occurred. | code | html |
| VMInetAddress | code | html | |
| VMNetworkInterface | This class models a network interface on the host computer. | code | html |
| ZDatagramSocketImpl | This class is the new datagram socket implementation used by the datagram socket factory in place of the plain-old one. | code | html |
| ZInetAddressImpl | code | html | |
| ZInputStream | This class implements a growing ByteArrayInputStream. | code | html |
| ZObject | This class implements an object type suitable to be serialized in a non-standard way. | code | html |
| ZOutputStream | This object models an output stream that sends data through a Connector instance. | code | html |
| ZSocketImpl | This class is the main entry point to the compression layer. | code | html |
| ZSocketImplFactory | This class provides a new socket factory and it's the main entry point into the compression layer. | code | html |
The java.net package can be roughly divided in two sections:
A Low Level API, which deals with the following abstractions:
Addresses, which are networking identifiers, like IP addresses.
Sockets, which are basic bidirectional data communication mechanisms.
Interfaces, which describe network interfaces.
A High Level API, which deals with the following abstractions:
URIs, which represent Universal Resource Identifiers.
URLs, which represent Universal Resource Locators.
Connections, which represents connections to the resource pointed to by URLs.
Addresses are used throughout the java.net APIs as either host identifiers, or socket endpoint identifiers.
The java.net.InetAddress class is the abstraction representing an IP (Internet Protocol) address. It has two subclasses:
But, in most cases, there is no need to deal directly with the subclasses, as the InetAddress abstraction should cover most of the needed functionality.
Not all systems have support for the IPv6 protocol, and while the Java networking stack will attempt to detect it and use it transparently when available, it is also possible to disable its use with a system property. In the case where IPv6 is not available, or explicitly disabled, Inet6Address are not valid arguments for most networking operations any more. While methods like java.net.InetAddress#getByName are guaranteed not to return an Inet6Address when looking up host names, it is possible, by passing literals, to create such an object. In which case, most methods, when called with an Inet6Address will throw an Exception.
Sockets are means to establish a communication link between machines over the network. The java.net package provides 4 kinds of Sockets:
Sending and receiving with TCP sockets is done through InputStreams and OutputStreams which can be obtained via the java.net.Socket#getInputStream and java.net.Socket#getOutputStream methods.
The java.net.NetworkInterface class provides APIs to browse and query all the networking interfaces (e.g. ethernet connection or PPP endpoint) of the local machine. It is through that class that you can check if any of the local interfaces is configured to support IPv6.
A number of classes in the java.net package do provide for a much higher level of abstraction and allow for easy access to resources on the network. The classes are:
The recommended usage is to use java.net.URI to identify resources, then convert it into a java.net.URL when it is time to access the resource. From that URL, you can either get the java.net.URLConnection for fine control, or get directly the InputStream.
Here is an example:
URI uri = new URI("http://java.sun.com/");
URL url = uri.toURL();
InputStream in = url.openStream();
myproto://myhost.mydomain/resource/), a similar URL will try to instantiate the handler for the specified protocol; if it doesn't exist an exception will be thrown.
By default the protocol handlers are loaded dynamically from the default location. It is, however, possible to add to the search path by setting the java.protocol.handler.pkgs system property. For instance if it is set to myapp.protocols, then the URL code will try, in the case of http, first to load myapp.protocols.http.Handler, then, if this fails, http.Handler from the default location.
Note that the Handler class has to be a subclass of the abstract class java.net.URLStreamHandler .