code: private synchronized void readObject(java.io.ObjectInputStream s)
           throws IOException, ClassNotFoundException
      {
          s.defaultReadObject();  // read the fields
          if ((handler = getDelegate().getURLStreamHandler(protocol)) == null) {
              throw new IOException("unknown protocol: " + protocol);
          }
  
          // Construct authority part
          if (authority == null &&
              ((host != null && host.length() > 0) || port != -1)) {
              if (host == null)
                  host = "";
              authority = (port == -1) ? host : host + ":" + port;
  
              // Handle hosts with userInfo in them
              int at = host.lastIndexOf('@');
              if (at != -1) {
                  userInfo = host.substring(0, at);
                  host = host.substring(at+1);
              }
          } else if (authority != null) {
              // Construct user info part
              int ind = authority.indexOf('@');
              if (ind != -1)
                  userInfo = authority.substring(0, ind);
          }
  
          // Construct path and query part
          path = null;
          query = null;
          if (file != null) {
              // Fix: only do this if hierarchical?
              int q = file.lastIndexOf('?');
              if (q != -1) {
                  query = file.substring(q+1);
                  path = file.substring(0, q);
              } else
                  path = file;
          }
          hashCode = -1;
      }
docs: readObject is called to restore the state of the URL from the
  stream.  It reads the components of the URL and finds the local
  stream handler.