Java Applet 随机存取存储
我有一个java项目,它使用java.io.RandomAccessFile来管理数据加载。它通过文件进行搜索,创建关键点图,然后可以根据需要加载该图。这很好用。
我想让它作为小程序运行,但它需要安全权限来创建一个可以存储下载文件的临时文件,这对其预期用途来说是一个巨大的障碍。
我想我可以腾出内存(几MB)来将内容存储在某种内存缓冲区中,然后以与处理本地文件相同的方式随机访问它...
有没有一种方法可以创建临时文件而不需要安全权限(我假设没有)?
最好的缓冲选项是什么?如何将基于 URL 的输入流的内容放入缓冲区,从中读取字节,并能够记录和更改当前的查找位置?
I have a java project that uses java.io.RandomAccessFile to manage data loading. It seeks through the file creating a map of key points which can then be loaded as needed later. This works great.
I want to make it run as an applet but it requires security permissions to create a temp file that a downloaded file could be stored in, and that's a huge barrier for it's intended usage.
I think I can spare the memory (a few MB) to store the contents in a memory buffer of some sort and then random access it in the same way I treat local files...
Is there a way to create a temp file without requiring security permissions (I assume not)?
What is the best buffering option? How would I get the contents of a URL based input stream into the buffer, read bytes from it, and be able to record and change the current seek position?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先查看此讨论:用于内存字节数组的类似 RandomAccessFile 的 API?
Check this discussion first: RandomAccessFile-like API for in-memory byte array?