Javascript FileReader.slice(startingByte, endindByte) 相当于 java

Javascript FileReader.slice(startingByte, endindByte) equivalent in java

参考以下规格:

https://www.w3.org/TR/FileAPI/#slice-method-algo

有一种方法FileReader.slice(startingByte, endindByte)允许从特定的starting byteending byte读取文件,这在读取非常大的文件(1GB+)时非常有用。

java中的等效方法是什么?

你可以使用seek方法,这里有文档 https://docs.oracle.com/javase/7/docs/api/java/io/RandomAccessFile.html http://www.cs.usfca.edu/~parrt/course/601/lectures/io.html