I have a Processing script in which I'm plotting a small subset of data from a very large file that is constantly being updated. The data will be randomly accessed based on user input, and so to increase speed without loading the whole file into memory I've been memory mapping the file as a ByteBuffer. This works exceptionally well when run on a local machine, but unfortunately the end goal of the project is a web applet. Is there a good way of creating memory mapped or random access file structures from files accessed within an applet? I looked a lot at URL.openStream(), but couldn't figure out how to turn the InputStream into what I need. Here is what I had for the offline app:
//within my GraphicPlot class:
ByteBuffer bbuf;
FileChannel fc;
SetUpPlot(String fileName){
try {
FileInputStream instream = new FileInputStream(fileName);
fc = instream.getChannel();
bbuf = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
}
catch (IOException e) {
e.printStackTrace();
exit();
}
}
No matter how I send the URL to the function (absolute URL, relative URL, etc) I get a file not found error.
Any help would be greatly appreciated!
EDIT: I should probably mention that the applet will be signed, and the file in question will be hosted in the same directory as the applet, so there shouldn't be any applet permission problems.