Chris Rathman / Chris.Rathman@tx.rr.com

/************************************************************************
 *                                                                      *
 * java.net                                                             *
 *                                                                      *
 *    Interfaces:                                                       *
 *       ContentHandlerFactory           SocketImplFactory              *
 *       FileNameMap                     URLStreamHandlerFactory        *
 *                                                                      *
 *    Classes:                                                          *
 *       ContentHandler                  ServerSocket                   *
 *       DatagramPacket                  Socket                         *
 *       DatagramSocket                  SocketImpl                     *
 *       DatagramSocketImpl              URL                            *
 *       HttpURLConnection               URLConnection                  *
 *       InetAddress                     URLEncoder                     *
 *       MulticastSocket                 URLStreamHandler               *
 *                                                                      *
 *    Exceptions:                                                       *
 *       BindException                   ProtocolException              *
 *       ConnectException                SocketException                *
 *       MalformedURLException           UnknownHostException           *
 *       NoRouteToHostException          UnknownServiceException        *
 *                                                                      *
 ************************************************************************/
package Test.Chris;
import java.net.*;

public class Java_net {
   public void exercise() {
      inetaddress();
      url();
      urlconnection();
      urlencoder();

      serversocket();
      socket();

      datagramsocket();
      datagrampacket();

      contenthandler();
      datagramsocketimpl();
      httpurlconnection();
      multicastsocket();
      socketimpl();
      urlstreamhandler();
      contenthandlerfactory();
      filenamemap();
      socketimplfactory();
      urlstreamhandlerfactory();
   }

   /*********************************************************************
    *                                                                   *
    * InetAddress:                                                      *
    *                                                                   *
    *    Desc:                                                          *
    *                                                                   *
    *    Methods:                                                       *
    *       equals               getHostAddress       isMulticastAddress*
    *       getAddress           getHostName          toString          *
    *       getAllByName         getLocalHost                           *
    *       getByName            hashCode                               *
    *                                                                   *
    *********************************************************************/
   void inetaddress() {
      int i;
      boolean f;
      String s;
      byte[] b;
      InetAddress addr;
      InetAddress addrs;
      InetAddress[] addrx;

      try {
         addr = InetAddress.getLocalHost();  // returns the local host
         s = addr.getHostName();        // returns fully qualified host name for this address
         s = addr.getHostAddress();     // returns the IP address string "%d.%d.%d.%d"
         b = addr.getAddress();         // returns the raw IP address of this InetAddress object
         f = addr.isMulticastAddress(); // check if the InetAddress is a IP multicast address

         addr = InetAddress.getByName("rhcus");      // determines IP address of host
         addrx = InetAddress.getAllByName("rhcus");  // all IP addresses of host
         for (i = 0; i < addrx.length; i++) {
            s = addrx[i].getHostName();
            s = addrx[i].getHostAddress();
         }

         addrs = InetAddress.getByName("rhcus");
         f = addr.equals(addrs);        // compares this object against the specified object
         i = addr.hashCode();           // returns a hashcode for this IP address
         s = addr.toString();           // converts this IP address to a String

      } catch(UnknownHostException e) {
      }
   }

   /*********************************************************************
    *                                                                   *
    * URL:                                                              *
    *                                                                   *
    *    Desc:                                                          *
    *                                                                   *
    *    Methods:                                                       *
    *       equals                         hashCode                     *
    *       getContent                     openConnection               *
    *       getFile                        openStream                   *
    *       getHost                        sameFile                     *
    *       getPort                        setURLStreamHandlerFactory   *
    *       getProtocol                    toExternalForm               *
    *       getRef                         toString                     *
    *                                                                   *
    *********************************************************************/
   void url() {
      int i;
      boolean f;
      String s;
      java.io.BufferedInputStream p;
      URLConnection c;

      try {
         URL xa = new URL("http://rhcus/index.html");

         java.io.BufferedReader in =    // opens connection to URL and returns an InputStream
            new java.io.BufferedReader(new java.io.InputStreamReader(xa.openStream()));
         while (!(null == (s = in.readLine()))) {
            // System.out.println(s);
         }
         in.close();

         p = (java.io.BufferedInputStream)xa.getContent();    // returns the contents of this URL
         while (p.available() > 0) {
            i = p.read();
         }
         p.close();

         c = xa.openConnection();       // returns URLConnection to the remote object referred to by the URL

         s = xa.getFile();              // returns the file name of this URL
         s = xa.getHost();              // returns the host name of this URL, if applicable
         i = xa.getPort();              // returns the port number of this URL
         s = xa.getProtocol();          // returns the protocol name this URL
         s = xa.getRef();               // returns the anchor (also known as the "reference") of this URL

         URL xb = new URL("http://rhcus/index.html");
         f = xa.sameFile(xb);           // compares two URLs, excluding the "ref" fields
         f = xa.equals(xa);             // compares two URLs
         i = xa.hashCode();             // creates an integer suitable for hash table indexing
         s = xa.toString();             // constructs a string representation of this URL
         s = xa.toExternalForm();       // constructs a string representation of this URL

      } catch(MalformedURLException e) {
      } catch(java.io.IOException e) {
      }

   /* TO BE DETERMINED
      setURLStreamHandlerFactory(URLStreamHandlerFactory)  // sets an application's URLStreamHandlerFactory
   */
   }

   /*********************************************************************
    *                                                                   *
    * URLConnection:                                                    *
    *                                                                   *
    *    Desc:                                                          *
    *                                                                   *
    *    Methods:                                                       *
    *      connect                        getInputStream                *
    *      getAllowUserInteraction        getLastModified               *
    *      getContent                     getOutputStream               *
    *      getContentEncoding             getRequestProperty            *
    *      getContentLength               getURL                        *
    *      getContentType                 getUseCaches                  *
    *      getDate                        guessContentTypeFromStream    *
    *      getDefaultAllowUserInteraction setAllowUserInteraction       *
    *      getDefaultRequestProperty      setContentHandlerFactory      *
    *      getDefaultUseCaches            setDefaultAllowUserInteraction*
    *      getDoInput                     setDefaultRequestProperty     *
    *      getDoOutput                    setDefaultUseCaches           *
    *      getExpiration                  setDoInput                    *
    *      getFileNameMap                 setDoOutput                   *
    *      getHeaderField                 setFileNameMap                *
    *      getHeaderField                 setIfModifiedSince            *
    *      getHeaderFieldDate             setRequestProperty            *
    *      getHeaderFieldInt              setUseCaches                  *
    *      getHeaderFieldKey              toString                      *
    *      getIfModifiedSince                                           *
    *                                                                   *
    *      Header Keys                                                  *
    *      0   null                       5   Content-Length            *
    *      1   Date                       6   Accept-Ranges             *
    *      2   Server                     7   Keep-Alive                *
    *      3   Last-Modified              8   Connection                *
    *      4   ETag                       9   Content-Type              *
    *                                                                   *
    *********************************************************************/
   void urlconnection() {
      int i;
      long n;
      java.io.BufferedInputStream p;
      FileNameMap fn;
      java.io.InputStream ios;

      String s;
      boolean f;

      try {
         URL xa = new URL("http://rhcus/index.html");
         URLConnection xc = xa.openConnection();

         xc.setAllowUserInteraction(false);              // set the value of the allowUserInteraction field
         xc.setDefaultAllowUserInteraction(false);       // sets default value of allowUserInteraction field
         xc.setDefaultUseCaches(true);                   // sets default value of useCaches field
         xc.setDoInput(true);                            // sets doInput field for this URLConnection
         xc.setDoOutput(false);                          // sets doOutput field for this URLConnection
         //xc.setFileNameMap(null);                      // sets the FileNameMap
         xc.setIfModifiedSince(0);                       // sets the value of the ifModifiedSince field
         xc.setUseCaches(true);                          // sets value of useCaches field
         xc.setRequestProperty("PropX", "Hello");        // sets general request property
         xc.setDefaultRequestProperty("PropY", "World"); // sets default value of a general request property

         xc.connect();                  // opens comm link to the resource referenced by URL

         p = (java.io.BufferedInputStream)xc.getContent();    // returns the contents of this URL
         while (p.available() > 0) {
            i = p.read();
         }
         p.close();

         f = xc.getAllowUserInteraction();         // value of allowUserInteraction field (false)
         s = xc.getContentEncoding();              // value of content-encoding header field (null)
         i = xc.getContentLength();                // value of content-length header field (-1)
         s = xc.getContentType();                  // value of content-type header field (text/html)
         n = xc.getDate();                         // value of the date header field
         f = xc.getDefaultAllowUserInteraction();  // default value of allowUserInteraction field (false)
         f = xc.getDefaultUseCaches();             // default value of URLConnection's useCaches flag (true)
         f = xc.getDoInput();                      // value of this URLConnection's doInput flag (true)
         f = xc.getDoOutput();                     // value of this URLConnection's doOutput flag (false)
         n = xc.getExpiration();                   // value of the expires header field (0)
         // fn = xc.getFileNameMap();              // returns the FileNameMap (null)
         n = xc.getIfModifiedSince();              // value of this object's ifModifiedSince field (0)
         n = xc.getLastModified();                 // value of last-modified header field (0)
         xa = xc.getURL();                         // value of this URLConnection's URL field
         f = xc.getUseCaches();                    // value of this URLConnection's useCaches field (true)
         s = xc.getRequestProperty("PropX");       // value of named general request property
         s = xc.getDefaultRequestProperty("PropY");// value of default request property (null???)

         s = xc.getHeaderField(1);                       // value for the nth header field
         s = xc.getHeaderField("Server");                // value of specified header field
         n = xc.getHeaderFieldDate("Date", 0);           // value of named field parsed as date
         i = xc.getHeaderFieldInt("Content-Length", 0);  // value of named field parsed as a number
         s = xc.getHeaderFieldKey(1);                    // key for the nth header field

         s = xc.toString();             // returns a String representation of this URL connection

      } catch(MalformedURLException e) {
      } catch(java.io.IOException e) {
      }

   /*
         ios = xc.getInputStream();                  // returns an input stream that reads from connection
         s = xc.guessContentTypeFromStream(ios);     // tries to determine type of input stream
         xc.getOutputStream();                       // returns an output stream that writes to connection
         xc.setContentHandlerFactory(ContentHandlerFactory)   // sets ContentHandlerFactory of an application
   */
   }

   /*********************************************************************
    *                                                                   *
    * URLEncoder:                                                       *
    *                                                                   *
    *    Desc:                                                          *
    *                                                                   *
    *    Methods:                                                       *
    *       encode                                                      *
    *                                                                   *
    *********************************************************************/
   void urlencoder() {
      String s;
      s = URLEncoder.encode("a! b?");   // translates string into x-www-form-urlencoded format
   }

   /*********************************************************************
    *                                                                   *
    * ServerSocket:                                                     *
    *                                                                   *
    *    Desc:                                                          *
    *                                                                   *
    *    Methods:                                                       *
    *       accept               getLocalPort         setSocketFactory  *
    *       close                getSoTimeout         setSoTimeout      *
    *       getInetAddress       implAccept           toString          *
    *                                                                   *
    *********************************************************************/
   class myServer implements Runnable {
      public void run() {
         int i;
         String s;
         InetAddress addr;
         Socket client;
         ServerSocket server;

         try {
            server = new ServerSocket(1234);

            addr = server.getInetAddress();  // returns the local address of this server socket
            i = server.getLocalPort();       // returns the port on which this socket is listening
            i = server.getSoTimeout();       // retrive setting for SO_TIMEOUT
            server.setSoTimeout(i);          // enable/disable SO_TIMEOUT with the specified timeout
            s = server.toString();           // returns address and port of this socket as a String

            client = server.accept();   // listens for a connection to be made to this socket and accepts it

            java.io.InputStream in = (java.io.InputStream)client.getInputStream();
            java.io.OutputStream out = (java.io.OutputStream)client.getOutputStream();

            // read some bytes
            i = in.read();
            System.out.println("Server read = " + i);
            java.io.BufferedReader bin = new java.io.BufferedReader(new java.io.InputStreamReader(in));
            s = bin.readLine();
            System.out.println("Server readLine = " + s);

            // write some bytes
            out.write(43);
            java.io.PrintWriter pout = new java.io.PrintWriter(out, true);
            pout.println("Goodbye");

            // read serialized java object
            java.io.ObjectInputStream oin = new java.io.ObjectInputStream(in);
            try {
               java.util.Date d = (java.util.Date)oin.readObject();
               System.out.println("Server readObject = " + d);
            } catch (ClassNotFoundException e) {
            }

            // send serialized java object
            java.io.ObjectOutputStream oout = new java.io.ObjectOutputStream(out);
            oout.writeObject(new java.util.Date());
            oout.flush();

            client.close();
            server.close();             // closes this socket

         } catch (java.io.IOException e) {
         }
      }

   /* TO BE DETERMINED
      implAccept(Socket)                // subclasses of ServerSocket use this method to override accept() to return their own subclass of socket
      setSocketFactory(SocketImplFactory) // sets the server socket implementation factory for the application
   */
   }

   void serversocket() {
      myServer srv = new myServer();
      Thread x = new Thread((Runnable)srv);
      x.setDaemon(true);
      x.start();

      /* Simple HTTP server
      try {
         ServerSocket server = new ServerSocket(1000);
         Socket client = server.accept();

         java.io.BufferedReader in = new java.io.BufferedReader(
            new java.io.InputStreamReader(client.getInputStream(), "8859_1"));
         java.io.OutputStream out = (java.io.OutputStream)client.getOutputStream();
         java.io.PrintWriter pout = new java.io.PrintWriter(
            new java.io.OutputStreamWriter(out, "8859_1"), true);
         String request = in.readLine();
         System.out.println("Request: " + request);

         java.util.StringTokenizer st = new java.util.StringTokenizer(request);
         if ((st.countTokens() >= 2) && (st.nextToken().equals("GET"))) {
            if ((request = st.nextToken()).startsWith("/")) request = request.substring(1);
            if ((request.endsWith("/")) || (request.equals(""))) request = request + "index.html";
            try {
               java.io.FileInputStream fis = new java.io.FileInputStream("/inetpub/wwwroot/" + request);
               byte[] data = new byte[fis.available()];
               fis.read(data);
               out.write(data);
               out.flush();
            } catch(java.io.FileNotFoundException e) {
               pout.println("404 File Not Found");
            }
         } else {
            pout.println("400 Bad Request");
         }
      } catch(java.io.IOException e) {
      }
      */
   }

   /*********************************************************************
    *                                                                   *
    * Socket:                                                           *
    *                                                                   *
    *    Desc:                                                          *
    *                                                                   *
    *    Methods:                                                       *
    *       close              getOutputStream     setSocketImplFactory *
    *       getInetAddress     getPort             setSoLinger          *
    *       getInputStream     getSoLinger         setSoTimeout         *
    *       getLocalAddress    getSoTimeout        setTcpNoDelay        *
    *       getLocalPort       getTcpNoDelay       toString             *
    *                                                                   *
    *********************************************************************/
   void socket() {
      int i;
      boolean f;
      String s;
      java.io.InputStream in;
      java.io.OutputStream out;
      InetAddress addr;
      Socket sock;

      try {
         sock = new Socket("181.127.218.30", 1234);

         addr = sock.getInetAddress();  // returns the address to which the socket is connected
         i = sock.getPort();            // returns the remote port to which this socket is connected
         addr = sock.getLocalAddress(); // gets the local address to which the socket is bound
         i = sock.getLocalPort();       // returns the local port to which this socket is bound

         i = sock.getSoLinger();        // returns setting for SO_LINGER
         if (i != -1) {
            sock.setSoLinger(true, i); // enable/disable SO_LINGER with the specified linger time
         }
         i = sock.getSoTimeout();       // returns setting for SO_TIMEOUT
         sock.setSoTimeout(i);          // enable/disable SO_TIMEOUT with the specified timeout, in milliseconds
         f = sock.getTcpNoDelay();      // tests if TCP_NODELAY is enabled
         sock.setTcpNoDelay(f);         // enable/disable TCP_NODELAY (disable/enable Nagle's algorithm)

         in = sock.getInputStream();    // returns an input stream for this socket
         out = sock.getOutputStream();  // returns an output stream for this socket

         // send some bytes
         out.write(42);
         java.io.PrintWriter pout = new java.io.PrintWriter(out, true);
         pout.println("Hello World");

         // read some bytes
         i  = in.read();
         System.out.println("Client read = " + i);
         java.io.BufferedReader bin = new java.io.BufferedReader(new java.io.InputStreamReader(in));
         s = bin.readLine();
         System.out.println("Client readLine = " + s);

         // send serialized java object
         java.io.ObjectOutputStream oout = new java.io.ObjectOutputStream(out);
         oout.writeObject(new java.util.Date());
         oout.flush();

         // read serialized java object
         java.io.ObjectInputStream oin = new java.io.ObjectInputStream(in);
         try {
            java.util.Date d = (java.util.Date)oin.readObject();
            System.out.println("Client readObject = " + d);
         } catch (ClassNotFoundException e) {
         }

         s = sock.toString();           // converts this socket to a String
         sock.close();                  // closes this socket

      } catch(UnknownHostException e) {
      } catch(java.io.IOException e) {
      }


      /* get time from remote server
      try {
         sock = new Socket("sura.net", 37);
         java.io.DataInputStream din = new java.io.DataInputStream(sock.getInputStream());
         i = din.readInt();
         sock.close();
         long n = (((1L << 32) + i) - 2208988800L) * 1000;
      } catch(UnknownHostException e) {
      } catch(java.io.IOException e) {
      }
      */

   /* TO BE DETERMINED
      setSocketImplFactory(SocketImplFactory)   // sets the client socket implementation factory for the application
   */
   }

   /*********************************************************************
    *                                                                   *
    * DatagramSocket:                                                   *
    *                                                                   *
    *    Desc:                                                          *
    *                                                                   *
    *    Methods:                                                       *
    *       close                getSoTimeout         setSoTimeout      *
    *       getLocalAddress      receive                                *
    *       getLocalPort         send                                   *
    *                                                                   *
    *********************************************************************/
   class myDatagramServer implements Runnable {
      public void run() {
         int i;
         String s;
         InetAddress addr;
         DatagramSocket dsocket;
         DatagramPacket dpacket;

         try {
            dsocket = new DatagramSocket(1001);

            addr = dsocket.getLocalAddress();  // gets the local address to which the socket is bound
            i = dsocket.getLocalPort();        // port number on the local host to which this socket is bound
            i = dsocket.getSoTimeout();        // retrive setting for SO_TIMEOUT
            dsocket.setSoTimeout(i);           // enable/disable SO_TIMEOUT with the specified timeout

            for (i = 0; i < 5; i++) {
               dpacket = new DatagramPacket(new byte[10], 10);
               dsocket.receive(dpacket);       // receives a datagram packet from this socket
               s = new String(dpacket.getData());
               System.out.println("Datagram from: " + dpacket.getAddress().getHostName() + " - " + s);
            }
            dsocket.close();                   // closes this datagram socket

         } catch(SocketException e) {
         } catch(java.io.IOException e) {
         }
      }
   }

   void datagramsocket() {
      myDatagramServer srv = new myDatagramServer();
      Thread x = new Thread((Runnable)srv);
      x.start();
      try {
         Thread.sleep(500);
      } catch(InterruptedException e) {
      }
   }

   /*********************************************************************
    *                                                                   *
    * DatagramPacket:                                                   *
    *                                                                   *
    *    Desc:                                                          *
    *                                                                   *
    *    Methods:                                                       *
    *       getAddress           getPort              setLength         *
    *       getData              setAddress           setPort           *
    *       getLength            setData                                *
    *                                                                   *
    *********************************************************************/
   void datagrampacket() {
      int i;
      int j;
      String s;
      byte[] data;
      InetAddress addr;
      DatagramPacket dpacket;
      DatagramSocket dsocket;

      try {
         addr = InetAddress.getByName("CRathman");

         dsocket = new DatagramSocket();
         for (i = 0; i < 5; i++) {
            s = "Hello: " + i;
            data = s.getBytes();
            dpacket = new DatagramPacket(data, data.length, addr, 1001);

            addr = dpacket.getAddress();  // IP address of the machine to which this datagram is being sent
            dpacket.setAddress(addr);
            j = dpacket.getPort();        // port number on remote host to which this datagram is being sent
            dpacket.setPort(j);
            data = dpacket.getData();     // data received or the data to be sent
            dpacket.setData(data);
            j = dpacket.getLength();      // length of the data to be sent or the length of the data received
            dpacket.setLength(j);

            dsocket.send(dpacket);      // sends a datagram packet from this DatagramSocket
         }
         dsocket.close();

      } catch(java.io.IOException e) {
      }
   }

   /*********************************************************************
    *                                                                   *
    * DatagramSocketImpl:                                               *
    *                                                                   *
    *    Desc:                                                          *
    *                                                                   *
    *    Methods:                                                       *
    *       bind                 getLocalPort         peek              *
    *       close                getTTL               receive           *
    *       create               join                 send              *
    *       getFileDescriptor    leave                setTTL            *
    *                                                                   *
    *********************************************************************/
   void datagramsocketimpl() {
   /*
      bind(int, InetAddress)            // Binds a datagram socket to a local port and address
      close()                           // Close the socket
      create()                          // Creates a datagram socket
      getFileDescriptor()               // Get the datagram socket file descriptor
      getLocalPort()                    // Get the local port
      getTTL()                          // Retrieve the TTL (time-to-live) option
      join(InetAddress)                 // Join the multicast group
      leave(InetAddress)                // Leave the multicast group
      peek(InetAddress)                 // Peek at the packet to see who it is from
      receive(DatagramPacket)           // Receive the datagram packet
      send(DatagramPacket)              // Sends a datagram packet
      setTTL(byte)                      // Set the TTL (time-to-live) option
   */
   }

   /*********************************************************************
    *                                                                   *
    * ContentHandler:                                        (abstract) *
    *                                                                   *
    *    Desc:                                                          *
    *                                                                   *
    *    Methods:                                                       *
    *       getContent                                                  *
    *                                                                   *
    *********************************************************************/
   void contenthandler() {
   /*
      getContent(URLConnection)         // Given a URL connect stream positioned at the beginning of the representation of an object, this method reads that stream and creates an object from it
   */
   }

   /*********************************************************************
    *                                                                   *
    * HttpURLConnection:                                                *
    *                                                                   *
    *    Desc:                                                          *
    *                                                                   *
    *    Vars:                                                          *
    *       HTTP_ACCEPTED                  HTTP_NOT_AUTHORITATIVE       *
    *       HTTP_BAD_GATEWAY               HTTP_NOT_FOUND               *
    *       HTTP_BAD_METHOD                HTTP_NOT_MODIFIED            *
    *       HTTP_BAD_REQUEST               HTTP_OK                      *
    *       HTTP_CLIENT_TIMEOUT            HTTP_PARTIAL                 *
    *       HTTP_CONFLICT                  HTTP_PAYMENT_REQUIRED        *
    *       HTTP_CREATED                   HTTP_PRECON_FAILED           *
    *       HTTP_ENTITY_TOO_LARGE          HTTP_PROXY_AUTH              *
    *       HTTP_FORBIDDEN                 HTTP_REQ_TOO_LONG            *
    *       HTTP_GATEWAY_TIMEOUT           HTTP_RESET                   *
    *       HTTP_GONE                      HTTP_SEE_OTHER               *
    *       HTTP_INTERNAL_ERROR            HTTP_SERVER_ERROR            *
    *       HTTP_LENGTH_REQUIRED           HTTP_UNAUTHORIZED            *
    *       HTTP_MOVED_PERM                HTTP_UNAVAILABLE             *
    *       HTTP_MOVED_TEMP                HTTP_UNSUPPORTED_TYPE        *
    *       HTTP_MULT_CHOICE               HTTP_USE_PROXY               *
    *       HTTP_NO_CONTENT                HTTP_VERSION                 *
    *       HTTP_NOT_ACCEPTABLE                                         *
    *                                                                   *
    *    Methods:                                                       *
    *       disconnect           getResponseCode      setRequestMethod  *
    *       getFollowRedirects   getResponseMessage   usingProxy        *
    *       getRequestMethod     setFollowRedirects                     *
    *                                                                   *
    *********************************************************************/
   void httpurlconnection() {
   /*
      HTTP_ACCEPTED
      HTTP_BAD_GATEWAY
      HTTP_BAD_METHOD
      HTTP_BAD_REQUEST                  // 4XX: client error
      HTTP_CLIENT_TIMEOUT
      HTTP_CONFLICT
      HTTP_CREATED
      HTTP_ENTITY_TOO_LARGE
      HTTP_FORBIDDEN
      HTTP_GATEWAY_TIMEOUT
      HTTP_GONE
      HTTP_INTERNAL_ERROR
      HTTP_LENGTH_REQUIRED
      HTTP_MOVED_PERM
      HTTP_MOVED_TEMP
      HTTP_MULT_CHOICE                  // 3XX: relocation/redirect
      HTTP_NO_CONTENT
      HTTP_NOT_ACCEPTABLE
      HTTP_NOT_AUTHORITATIVE
      HTTP_NOT_FOUND
      HTTP_NOT_MODIFIED
      HTTP_OK                           // 2XX: generally "OK"
      HTTP_PARTIAL
      HTTP_PAYMENT_REQUIRED
      HTTP_PRECON_FAILED
      HTTP_PROXY_AUTH
      HTTP_REQ_TOO_LONG
      HTTP_RESET
      HTTP_SEE_OTHER
      HTTP_SERVER_ERROR                 // 5XX: server error
      HTTP_UNAUTHORIZED
      HTTP_UNAVAILABLE
      HTTP_UNSUPPORTED_TYPE
      HTTP_USE_PROXY
      HTTP_VERSION

      disconnect()                      // Close the connection to the server
      getFollowRedirects()
      getRequestMethod()                // Get the request method
      getResponseCode()                 // Gets HTTP response status
      getResponseMessage()              // Gets the HTTP response message, if any, returned along with the response code from a server
      setFollowRedirects(boolean)       // Sets whether HTTP redirects (requests with response code 3xx) should be automatically followed by this class
      setRequestMethod(String)          // Set the method for the URL request, one of: GET:POST:HEAD:OPTIONS:PUT:DELETE:TRACE: are legal, subject to protocol restrictions
      usingProxy()                      // Indicates if the connection is going through a proxy
   */
   }

   /*********************************************************************
    *                                                                   *
    * MulticastSocket:                                                  *
    *                                                                   *
    *    Desc:                                                          *
    *                                                                   *
    *    Methods:                                                       *
    *       getInterface         leaveGroup           setTTL            *
    *       getTTL               send                                   *
    *       joinGroup            setInterface                           *
    *                                                                   *
    *********************************************************************/
   void multicastsocket() {
   /*
      getInterface()                    // Retrieve the address of the network interface used for multicast packets
      getTTL()                          // Get the default time-to-live for multicast packets sent out on the socket
      joinGroup(InetAddress)            // Joins a multicast group
      leaveGroup(InetAddress)           // Leave a multicast group
      send(DatagramPacket, byte)        // Sends a datagram packet to the destination, with a TTL (time- to-live) other than the default for the socket
      setInterface(InetAddress)         // Set the outgoing network interface for multicast packets on this socket, to other than the system default
      setTTL(byte)                      // Set the default time-to-live for multicast packets sent out on this socket
   */
   }

   /*********************************************************************
    *                                                                   *
    * SocketImpl:                                                       *
    *                                                                   *
    *    Desc:                                                          *
    *                                                                   *
    *    Methods:                                                       *
    *       accept               connect              getLocalPort      *
    *       available            create               getOutputStream   *
    *       bind                 getFileDescriptor    getPort           *
    *       close                getInetAddress       listen            *
    *       connect              getInputStream       toString          *
    *                                                                   *
    *********************************************************************/
   void socketimpl() {
   /*
      accept(SocketImpl)                // Accepts a connection
      available()                       // Returns the number of bytes that can be read from this socket without blocking
      bind(InetAddress, int)            // Binds this socket to the specified port number on the specified host
      close()                           // Closes this socket
      connect(InetAddress, int)         // Connects this socket to the specified port number on the specified host
      connect(String, int)              // Connects this socket to the specified port on the named host
      create(boolean)                   // Creates either a stream or a datagram socket
      getFileDescriptor()               // Returns the value of this socket's fd field
      getInetAddress()                  // Returns the value of this socket's address field
      getInputStream()                  // Returns an input stream for this socket
      getLocalPort()                    // Returns the value of this socket's localport field
      getOutputStream()                 // Returns an output stream for this socket
      getPort()                         // Returns the value of this socket's port field
      listen(int)                       // Sets the maximum queue length for incoming connection indications (a request to connect) to the count argument
      toString()                        // Returns the address and port of this socket as a String
   */
   }

   /*********************************************************************
    *                                                                   *
    * URLStreamHandler:                                                 *
    *                                                                   *
    *    Desc:                                                          *
    *                                                                   *
    *    Methods:                                                       *
    *       openConnection       setURL               toExternalForm    *
    *       parseURL                                                    *
    *                                                                   *
    *********************************************************************/
   void urlstreamhandler() {
   /*
      openConnection(URL)               // Opens a connection to the object referenced by the URL argument
      parseURL(URL, String, int, int)   // Parses the string representation of a URL into a URL object
      setURL(URL, String, String, int, String, String)   // Sets the fields of the URL argument to the indicated values
      toExternalForm(URL)               // Converts a URL of a specific protocol to a String
   */
   }

   /*********************************************************************
    *                                                                   *
    * ContentHandlerFactory Interface:                                  *
    *                                                                   *
    *    Desc:                                                          *
    *                                                                   *
    *    Methods:                                                       *
    *       createContentHandler                                        *
    *                                                                   *
    *********************************************************************/
   void contenthandlerfactory() {
   /*
      createContentHandler(String)         // Creates a new ContentHandler to read an object from a URLStreamHandler
   */
   }

   /*********************************************************************
    *                                                                   *
    * FileNameMap Interface:                                            *
    *                                                                   *
    *    Desc:                                                          *
    *                                                                   *
    *    Methods:                                                       *
    *       getContentTypeFor                                           *
    *                                                                   *
    *********************************************************************/
   void filenamemap() {
   /*
      getContentTypeFor(String)
   */
   }

   /*********************************************************************
    *                                                                   *
    * SocketImplFactory Interface:                                      *
    *                                                                   *
    *    Desc:                                                          *
    *                                                                   *
    *    Methods:                                                       *
    *       createSocketImpl                                            *
    *                                                                   *
    *********************************************************************/
   void socketimplfactory() {
   /*
      createSocketImpl()                // Creates a new SocketImpl instance
   */
   }

   /*********************************************************************
    *                                                                   *
    * URLStreamHandlerFactory Interface:                                *
    *                                                                   *
    *    Desc:                                                          *
    *                                                                   *
    *    Methods:                                                       *
    *       createURLStreamHandler                                      *
    *                                                                   *
    *********************************************************************/
   void urlstreamhandlerfactory() {
   /*
      createURLStreamHandler(String)    // Creates a new URLStreamHandler instance with the specified protocol
   */
   }
}

Chris Rathman / Chris.Rathman@tx.rr.com