code: public void connect() throws IOException {
          if (!connected) {
              try {
                  filename = file.toString();
                  isDirectory = file.isDirectory();
                  if (isDirectory) {
                      String[] fileList = file.list();
                      if (fileList == null)
                          throw new FileNotFoundException(filename + " exists, but is not accessible");
                      files = Arrays.<String>asList(fileList);
                  } else {
  
                      is = new BufferedInputStream(new FileInputStream(filename));
  
                      // Check if URL should be metered
                      boolean meteredInput = ProgressMonitor.getDefault().shouldMeterInput(url, "GET");
                      if (meteredInput)   {
                          ProgressSource pi = new ProgressSource(url, "GET", file.length());
                          is = new MeteredStream(is, pi, file.length());
                      }
                  }
              } catch (IOException e) {
                  throw e;
              }
              connected = true;
          }
      }
docs: /*
  Note: the semantics of FileURLConnection object is that the
  results of the various URLConnection calls, such as
  getContentType, getInputStream or getContentLength reflect
  whatever was true when connect was called.