在 Java 7 中,使用下面的方法:
public class ContentToByteArrayExample
{
public static void main(String[] args)
{
Path path = Paths.get("C:/temp/test.txt");
byte[] data = Files.readAllBytes(path);
}
}
在 Java 7 中,使用下面的方法:
public class ContentToByteArrayExample
{
public static void main(String[] args)
{
Path path = Paths.get("C:/temp/test.txt");
byte[] data = Files.readAllBytes(path);
}
}