code: 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);
  	}
docs: --------------------------------------------------------------------------------------------