code: private FileStatus getFileStatus(FTPClient client, Path file)
        throws IOException {
      FileStatus fileStat = null;
      Path workDir = new Path(client.printWorkingDirectory());
      Path absolute = makeAbsolute(workDir, file);
      Path parentPath = absolute.getParent();
      if (parentPath == null) { // root dir
        long length = -1; // Length of root dir on server not known
        boolean isDir = true;
        int blockReplication = 1;
        long blockSize = DEFAULT_BLOCK_SIZE; // Block Size not known.
        long modTime = -1; // Modification time of root dir not known.
        Path root = new Path("/");
        return new FileStatus(length, isDir, blockReplication, blockSize,
            modTime, root.makeQualified(this));
      }
      String pathName = parentPath.toUri().getPath();
      FTPFile[] ftpFiles = client.listFiles(pathName);
      if (ftpFiles != null) {
        for (FTPFile ftpFile : ftpFiles) {
          if (ftpFile.getName().equals(file.getName())) { // file found in dir
            fileStat = getFileStatus(ftpFile, parentPath);
            break;
          }
        }
        if (fileStat == null) {
          throw new FileNotFoundException("File " + file + " does not exist.");
        }
      } else {
        throw new FileNotFoundException("File " + file + " does not exist.");
      }
      return fileStat;
    }
docs: Convenience method, so that we don't open a new connection when using this
  method from within another method. Otherwise every API invocation incurs
  the overhead of opening/closing a TCP connection.