天天看点

Java 中 File to byte[]

JDK1.7中nio的Files对象可以协助完成这个功能

File file = new File(filePath);
byte[] b = Files.readAllBytes(file.toPath());
           

完~