判断用户指定的本地文件路径是否合法有效，即文件存在且可读

@param localFilePath 本地文件路径
@throws ParamException
322751
public static void AssertLegalLocalFilePath(String localFilePath) throws ParamException {
        if (localFilePath == null || !CommonFileUtils.isLegalFile(localFilePath)) {
            throw new ParamException(localFilePath + " is not file or not exist or can't be read!");
        }
    }
99327
protected function downloadToTempLocalPath($url, $localPath)
    {
        try {
            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_HEADER, 0);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
            $rawFile = curl_exec($ch);
            curl_close($ch);

            if (false === $rawFile) {
                throw new CouldNotRetrieveRemoteFileException(
                    "curl_exec failed while downloading '{$url}': " . curl_error($ch)
                );
            }

        } catch (Exception $e) {
            throw new CouldNotRetrieveRemoteFileException(
                "Failed to download file content from '{$url}': ",
                $e->getCode(),
                $e
            );
        }

        try {
            if (false === file_put_contents($localPath, $rawFile)) {
                throw new CouldNotRetrieveRemoteFileException('file_put_contents call failed');
            }

        } catch (Exception $e) {

            throw new CouldNotRetrieveRemoteFileException(
                'file_put_contents call threw an exception',
                $e->getCode(),
                $e
            );
        }
    }
671486
void parseOneFile(final Path inputPath, final File outputFolder) throws IOException {
    try (final TFile.Reader.Scanner scanner = this.getScanner(inputPath)) {
      while (!scanner.atEnd()) {
        new LogFileEntry(scanner.entry()).write(outputFolder);
        scanner.advance();
      }
    }
  }
1262719
public static void changeLocalFilePermission(String filePath, String perms) throws IOException {
    Files.setPosixFilePermissions(Paths.get(filePath), PosixFilePermissions.fromString(perms));
  }
501379
void addCache(Path hdfsPath, Path localPath, long size) throws IOException {
    assert size == new File(localPath.toString()).length();
    assert size == fs.getFileStatus(hdfsPath).getLen();
    lookasideCache.addCache(hdfsPath, localPath, size);
  }
389075
@Deprecated
  public void copyToLocalFile(Path src, Path dst) throws IOException {
    copyToLocalFile(false, false, src, dst);
  }
581988
public void setParamTabDiCopyFileMode(String value) {

        try {
            m_userSettings.setDialogCopyFileMode(CmsResourceCopyMode.valueOf(Integer.parseInt(value)));
        } catch (Throwable t) {
            // should usually never happen
        }
    }
904975
private void scanPlatformPath(PackageSymbol p) throws IOException {
        fillIn(p, PLATFORM_CLASS_PATH,
               list(PLATFORM_CLASS_PATH,
                    p,
                    p.fullname.toString(),
                    allowSigFiles ? EnumSet.of(JavaFileObject.Kind.CLASS,
                                               JavaFileObject.Kind.OTHER)
                                  : EnumSet.of(JavaFileObject.Kind.CLASS)));
    }
894591
public function handle($path, $localFilePath, array $config = [])
    {
        if (! method_exists($this->filesystem, 'getAdapter')) {
            return false;
        }

        if (! method_exists($this->filesystem->getAdapter(), 'putFile')) {
            return false;
        }

        $config = new Config($config);
        if (method_exists($this->filesystem, 'getConfig')) {
            $config->setFallback($this->filesystem->getConfig());
        }

        return (bool) $this->filesystem->getAdapter()->putFile($path, $localFilePath, $config);
    }
1198316
public static LocalFileSystem getLocal(Configuration conf)
    throws IOException {
    return (LocalFileSystem)get(LocalFileSystem.NAME, conf);
  }
1147643
public static void AssertLegalCosFilePath(String cosFilePath) throws ParamException {
        if (cosFilePath == null || !cosFilePath.startsWith("/") || cosFilePath.endsWith("/")) {
            throw new ParamException(
                    cosFilePath + " is not cos file path! Tips: make sure not ends with /");
        }
        AssertNotContainIllegalLetter(cosFilePath);
    }
1312273
public static void changeLocalFileGroup(String path, String group) throws IOException {
    UserPrincipalLookupService lookupService =
        FileSystems.getDefault().getUserPrincipalLookupService();
    PosixFileAttributeView view =
        Files.getFileAttributeView(Paths.get(path), PosixFileAttributeView.class,
            LinkOption.NOFOLLOW_LINKS);
    GroupPrincipal groupPrincipal = lookupService.lookupPrincipalByGroupName(group);
    view.setGroup(groupPrincipal);
  }
929135
private static void loadFile(String filePath) {
        final Path path = FileSystems.getDefault().getPath(filePath);

        try {
            data.clear();
            data.load(Files.newBufferedReader(path));
        } catch(IOException e) {
            LOG.warn("Exception while loading " + path.toString(), e);
        }
    }
750245
@Deprecated
  public void deleteLocalFiles() throws IOException {
    String[] localDirs = getLocalDirs();
    for (int i = 0; i < localDirs.length; i++) {
      FileSystem.getLocal(this).delete(new Path(localDirs[i]));
    }
  }
940461
static LocalSubmissionFromCS fromSubmissionParameterFiles(final File localJobSubmissionParametersFile,
                                                            final File localAppSubmissionParametersFile)
      throws IOException {
    final AvroLocalAppSubmissionParameters localAppSubmissionParameters;

    final AvroLocalJobSubmissionParameters localJobSubmissionParameters;

    try (final FileInputStream fileInputStream = new FileInputStream(localJobSubmissionParametersFile)) {
      final JsonDecoder decoder = DecoderFactory.get().jsonDecoder(
          AvroLocalJobSubmissionParameters.getClassSchema(), fileInputStream);
      final SpecificDatumReader<AvroLocalJobSubmissionParameters> reader =
          new SpecificDatumReader<>(AvroLocalJobSubmissionParameters.class);
      localJobSubmissionParameters = reader.read(null, decoder);
    }

    try (final FileInputStream fileInputStream = new FileInputStream(localAppSubmissionParametersFile)) {
      final JsonDecoder decoder = DecoderFactory.get().jsonDecoder(
          AvroLocalAppSubmissionParameters.getClassSchema(), fileInputStream);
      final SpecificDatumReader<AvroLocalAppSubmissionParameters> reader =
          new SpecificDatumReader<>(AvroLocalAppSubmissionParameters.class);
      localAppSubmissionParameters = reader.read(null, decoder);
    }

    return new LocalSubmissionFromCS(localJobSubmissionParameters, localAppSubmissionParameters);
  }
343661
public void loadParamFile()
	{
		FlatFile ff = new FlatFile(paramFile);
		
				
		CloseableIterator<String> itr = null;
		
		try {
			itr = ff.getSequentialIterator();
		} catch (IOException io) {
			LOGGER.warning(io.toString());
		}
		
		paramSet = new HashSet<String>();

		while (itr.hasNext()) {
			String param = itr.next();
			param = param.trim();
			
			if (param.isEmpty() || param.startsWith("#")) {
				continue;
			}
			
			// Use only the first word, ignore the rest
			int wordEnd = param.indexOf(delim);
			if (wordEnd > 0) {
				param = param.substring(0, wordEnd);
			}
			
			paramSet.add(param);
		}
	}
1328652
private void handleAuxClassPathFromFile(String filePath) throws IOException {
        try (BufferedReader in = new BufferedReader(UTF8.fileReader(filePath))) {
            while (true) {
                String s = in.readLine();
                if (s == null) {
                    break;
                }
                project.addAuxClasspathEntry(s);
            }
        }
    }