Helper method that converts {@link FileInfo} collection to {@link FileStatus} collection.
772723
private Collection<FileStatus> toFileStatusesWithImplicitDirectories(
      Collection<FileInfo> fileInfos) throws IOException {
    List<FileStatus> fileStatuses = new ArrayList<>(fileInfos.size());
    Set<URI> filePaths = Sets.newHashSetWithExpectedSize(fileInfos.size());
    String userName = getUgiUserName();
    for (FileInfo fileInfo : fileInfos) {
      filePaths.add(fileInfo.getPath());
      fileStatuses.add(getFileStatus(fileInfo, userName));
    }

    // The flow for populating this doesn't bother to populate metadata entries for parent
    // directories but we know the parent directories are expected to exist, so we'll just
    // populate the missing entries explicitly here. Necessary for getFileStatus(parentOfInfo)
    // to work when using an instance of this class.
    for (FileInfo fileInfo : fileInfos) {
      URI parentPath = getGcsFs().getParentPath(fileInfo.getPath());
      while (parentPath != null && !parentPath.equals(GoogleCloudStorageFileSystem.GCS_ROOT)) {
        if (!filePaths.contains(parentPath)) {
          logger.atFine().log("Adding fake entry for missing parent path '%s'", parentPath);
          StorageResourceId id = pathCodec.validatePathAndGetId(parentPath, true);

          GoogleCloudStorageItemInfo fakeItemInfo =
              GoogleCloudStorageItemInfo.createInferredDirectory(id);
          FileInfo fakeFileInfo = FileInfo.fromItemInfo(pathCodec, fakeItemInfo);

          filePaths.add(parentPath);
          fileStatuses.add(getFileStatus(fakeFileInfo, userName));
        }
        parentPath = getGcsFs().getParentPath(parentPath);
      }
    }

    return fileStatuses;
  }
299732
public static FileStatus toFileStatus(HdfsFileStatus stat, String src) {
    if (stat == null) {
      return null;
    }
    return new FileStatus(stat.getLen(), stat.isDir(), stat.getReplication(),
        stat.getBlockSize(), stat.getModificationTime(),
        stat.getAccessTime(),
        stat.getPermission(), stat.getOwner(), stat.getGroup(),
        stat.getFullPath(new Path(src))); // full path
  }
489966
public static FileCollection list(FileListParams params, RequestOptions options)
      throws StripeException {
    return requestCollection(classUrl(File.class), params, FileCollection.class, options);
  }
459387
public static FileCollection list(Map<String, Object> params) throws StripeException {
    return list(params, null);
  }
1281661
private FileBaseStatistics getFileStats(FileBaseStatistics cachedStats, org.apache.hadoop.fs.Path[] hadoopFilePaths,
			ArrayList<FileStatus> files) throws IOException {

		long latestModTime = 0L;

		// get the file info and check whether the cached statistics are still valid.
		for (org.apache.hadoop.fs.Path hadoopPath : hadoopFilePaths) {

			final Path filePath = new Path(hadoopPath.toUri());
			final FileSystem fs = FileSystem.get(filePath.toUri());

			final FileStatus file = fs.getFileStatus(filePath);
			latestModTime = Math.max(latestModTime, file.getModificationTime());

			// enumerate all files and check their modification time stamp.
			if (file.isDir()) {
				FileStatus[] fss = fs.listStatus(filePath);
				files.ensureCapacity(files.size() + fss.length);

				for (FileStatus s : fss) {
					if (!s.isDir()) {
						files.add(s);
						latestModTime = Math.max(s.getModificationTime(), latestModTime);
					}
				}
			} else {
				files.add(file);
			}
		}

		// check whether the cached statistics are still valid, if we have any
		if (cachedStats != null && latestModTime <= cachedStats.getLastModificationTime()) {
			return cachedStats;
		}

		// calculate the whole length
		long len = 0;
		for (FileStatus s : files) {
			len += s.getLen();
		}

		// sanity check
		if (len <= 0) {
			len = BaseStatistics.SIZE_UNKNOWN;
		}

		return new FileBaseStatistics(latestModTime, len, BaseStatistics.AVG_RECORD_BYTES_UNKNOWN);
	}
437478
private FileStatus[] iterativeListing(String src) throws IOException {
    // fetch the first batch of entries in the directory
    DirectoryListing thisListing = namenode.getPartialListing(
        src, HdfsFileStatus.EMPTY_NAME);

    if (thisListing == null) { // the directory does not exist
      return null;
     }
    HdfsFileStatus[] partialListing = thisListing.getPartialListing();
    if (!thisListing.hasMore()) { // got all entries of the directory
      FileStatus[] stats = new FileStatus[partialListing.length];
      for (int i = 0; i < partialListing.length; i++) {
        stats[i] = HdfsFileStatus.toFileStatus(partialListing[i], src);
      }
      return stats;
    }

    // The directory size is too big that it needs to fetch more
    // estimate the total number of entries in the directory
    int totalNumEntries =
      partialListing.length + thisListing.getRemainingEntries();
    ArrayList<FileStatus> listing =
      new ArrayList<FileStatus>(totalNumEntries);
    // add the first batch of entries to the array list
    for (HdfsFileStatus fileStatus : partialListing) {
      listing.add(HdfsFileStatus.toFileStatus(fileStatus, src));
    }

    // now fetch more entries
    do {
      thisListing = namenode.getPartialListing(src, thisListing.getLastName());

      if (thisListing == null) {
        return null; // the directory is deleted
      }

      partialListing = thisListing.getPartialListing();
      for (HdfsFileStatus fileStatus : partialListing) {
        listing.add(HdfsFileStatus.toFileStatus(fileStatus, src));
      }
    } while (thisListing.hasMore());

    return listing.toArray(new FileStatus[listing.size()]);
  }
163756
private Set<String> convertAbsToRelative(Collection<File> files) {
        Set<String> result = new HashSet<String>();
        for (File f : files) {
            String fAbsPath = PathUtils.fixPathString(f); //assumption here that f is a dir, and path will end in File.seperator
            if (fAbsPath.startsWith(rootAbsolutePath)) {
                String absPath = fAbsPath; // canonicalPath(f);
                absPath = absPath.substring(rootAbsolutePath.length());
                if ("\\".equals(File.separator)) {
                    absPath = absPath.replace('\\', '/');
                }
                //handle / case. (path will have been the same, so the substring created emptystring)
                if (absPath.length() == 0) {
                    absPath = "/";
                }
                result.add(absPath);
            } else
                throw new IllegalStateException(fAbsPath + " " + rootAbsolutePath);
        }
        return result;
    }
893380
public FileStatus getFileStatus (Path f) throws IOException {
    try (Closeable context = new TimerContextWithLog(this.getFileStatusTimer.time(), "getFileStatus", f)) {
      return super.getFileStatus(f);
    }
  }
1045451
public FileStatus[] listStatus(Path path) throws IOException {
   try (TimerContextWithLog context = new TimerContextWithLog(listStatusTimer.time(), "listStatus", path)) {
      FileStatus[] statuses = super.listStatus(path);
      context.setResult(statuses);
      return statuses;
    }
  }
833325
FileStatus getFileInfo(String src, INode targetNode) {
    String srcs = normalizePath(src);
    readLock();
    try {
      if (targetNode == null) {
        return null;
      }
      else {
        return createFileStatus(srcs, targetNode);
      }
    } finally {
      readUnlock();
    }
  }
656996
private Collection<FileStatus> handleFile(final FileStatus file, final JobContext job) throws IOException {
        final List<FileStatus> results = Lists.newArrayList();

        if(file.isDir()) {
            final Path p = file.getPath();
            LOG.debug("Expanding {}", p);
            final FileSystem fs = p.getFileSystem(job.getConfiguration());
            final FileStatus[] children = fs.listStatus(p);
            for (FileStatus child : children) {
                results.addAll(handleFile(child, job));
            }
        } else {
            results.add(file);
        }

        return results;
    }
39649
@Override
  public FileStatus getFileStatus(Path f)  throws IOException {
    INode inode = store.retrieveINode(makeAbsolute(f));
    if (inode == null) {
      throw new FileNotFoundException(f + ": No such file or directory.");
    }
    return new S3FileStatus(f.makeQualified(this), inode);
  }
152043
public List<File> getAllFiles() {
		List<File> files = new ArrayList<File>();
		collectFiles(folder, files);
		Collections.sort(files, LastModifiedFileComparator.INSTANCE);
		return files;
	}
472037
protected Set<String> getGeneratedFiles() {
		Properties statusFileProps = getStatusProperties();
		if (statusFileProps != null) {
			return statusFileProps.stringPropertyNames();
		}
		return null;
	}
1072910
public Collection<FileInfo> getFileInfo(final Predicate<FileInfo> filter) {
        return files.values().stream()
                .filter(filter)
                .collect(Collectors.toList());
    }
1003505
@Override
  public FileStatus[] listStatus(Path f) throws IOException {
    return fs.listStatus(f, DEFAULT_FILTER);
  }
109741
public void setFileSystemIds(java.util.Collection<String> fileSystemIds) {
        if (fileSystemIds == null) {
            this.fileSystemIds = null;
            return;
        }

        this.fileSystemIds = new java.util.ArrayList<String>(fileSystemIds);
    }