I have a large (12GB) file and I need to extract small pieces of data (a few kilobytes each) from it, using Java. Seeking and reading the data, once the file is open, is very fast, but opening the file itself takes a long time - about 90 seconds. Is there a way to speed up the open file operation in Java?
To clarify, I've tried the following options to open and read a file:
new FileInputStream(file);
new RandomAccessFile(file, "r");
Files.newByteChannel(path, StandardOpenOption.READ);
Each one of these yielded similar results.