我正在尝试将文件的特定页面读入Byte []。我试过以下代码..
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
Path path = Paths.get("path/to/file");
byte[] data = Files.readAllBytes(path);
和
import java.io.RandomAccessFile;
RandomAccessFile f = new RandomAccessFile(fileName, "r");
byte[] b = new byte[(int)f.length()];
f.read(b);
但我不确定File类是否可以识别文件中的页面。所以任何人都可以建议我应该怎么做,非常感谢。
感谢。