将指定文件读成byte数据
@param filePath
@return
963977
public static byte[] read2ByteArray(String filePath) {
        try {
            BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(new File(filePath)));
            byte[] byteArr = new byte[bufferedInputStream.available()];
            bufferedInputStream.read(byteArr);
            bufferedInputStream.close();
            return byteArr;
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
178258
function getFile(filepath) {
	var fileObj = {
			path: filepath,
			content: null
	};
    try {
        fs.accessSync(filepath, fs.F_OK);
    } catch(e) {
			console.log(e.message);
        return fileObj;
    }
		fileObj.content = fs.readFileSync(filepath, 'utf-8').trim();
		return fileObj;
}
1141673
public static String getStringWithFilePathOrClasspath(
            String filePathOrClasspath, String charsetName) {
        return getStringAsOptWithFilePath(filePathOrClasspath, charsetName)
                .orElseGet(
                        () -> getStringAsOptWithClasspath(
                                filePathOrClasspath,
                                charsetName).orElse(null));
    }
449256
public static boolean isFileExist(String filePath) {
        if (StringUtils.isEmpty(filePath)) {
            return false;
        }

        File file = new File(filePath);
        return (file.exists() && file.isFile());
    }
414451
public static boolean generateImage(String imgStr, String imgFilePath) {
        if (imgStr == null) //图像数据为空
            return false;

        try {
            //Base64解码
            byte[] b = Base64.decodeBase64(imgStr);
            for (int i = 0; i < b.length; ++i) {
                if (b[i] < 0) {//调整异常数据
                    b[i] += 256;
                }
            }
            //生成jpeg图片
            OutputStream out = new FileOutputStream(imgFilePath);
            out.write(b);
            out.flush();
            out.close();
            return true;
        } catch (Exception e) {
            return false;
        }
    }
533477
public static FileInputStream getFileInputStream(String filePath) throws Exception {
        FileInputStream localFileInputStream = new FileInputStream(filePath);
        return localFileInputStream;
    }
710379
public SeleniumActionBuilder store(String filePath) {
        StoreFileAction action = new StoreFileAction();
        action.setFilePath(filePath);
        action(action);
        return this;
    }
838304
public static <I> JMFileSubscriber<I> buildJsonStringFileSubscriber(
            String filePath, Function<Object, String> toStringFunction) {
        return new JMFileSubscriber<>(filePath, toStringFunction);
    }
9574
public void writeFile(String filePath, byte[] data) throws IOException
   {
      Object lock = retrieveLock(filePath);      
      synchronized (lock) 
      {
         IO.writeFile(filePath, data);
      }
   }
697648
public static URL codeLocationFromPath(String filePath) {
        try {
            return new File(filePath).toURI().toURL();
        } catch (Exception e) {
            throw new InvalidCodeLocation(filePath);
        }
    }
910484
public static String file(String filePath) throws IOException {
        File f = new File(filePath);
        return file(f);
    }
388113
public static String formatFilePath(String filePath) {
        if (filePath == null) {
            return null;
        }
        return normalizePath(filePath.replaceAll("//*", "/").replaceAll("\\*", "\\").replaceAll("/", "\\" + System.getProperty("file.separator")).replaceAll("\\\\", "\\" + System.getProperty("file.separator")), System.getProperty("file.separator").equals("/"));

    }
712438
public static byte[] fileBytes(File file) throws IOException {

		FileInputStream fis = new FileInputStream(file);

		return streamBytes(fis);
	}
623097
public static byte[] readFile(String filePath) throws IOException {
        byte[] buffer = new byte[(int) new File(filePath).length()];
        BufferedInputStream f = null;
        try {
            f = new BufferedInputStream(new FileInputStream(filePath));
            f.read(buffer);
        } finally {
            if (f != null) {
                try {
                    f.close();
                } catch (final IOException ignored) {
                }
            }
        }
        return buffer;
    }
886654
public static long readNumberFromFile(final Path filePath)
      throws IOException, NumberFormatException {
    final List<String> allLines = Files.readAllLines(filePath);
    if (!allLines.isEmpty()) {
      return Long.parseLong(allLines.get(0));
    } else {
      throw new NumberFormatException("unable to parse empty file " + filePath.toString());
    }
  }
479712
public static boolean createFile(String filePath) {
        if (!StringUtils.isEmpty(filePath)) {
            File file = new File(filePath);
            return createFile(file);
        }
        return false;
    }
982435
public static InputStream readFileToInputStream(String filePath)
            throws FileNotFoundException {

        InputStream is = null;

        try {

            is = new FileInputStream(filePath);

            logger.info("Completed read file for input stream " + " Path: "
                    + filePath + " at " + PcDateUtils.getNowDateTimeStr());

        } catch (Exception e) {
            logger.error("Error read file." + e);
        }
        return is;

    }