[英]Most effective way to read/write large .ser file for online applet
I am writing an applet that I eventually want to put online so that my friends/family can use it. 我正在编写一个小程序,我最终希望将其放在网上,以便我的朋友/家人可以使用它。 I have the applet running now locally, but in order to work properly it needs to read a .ser file in when the applet opens, and update that same file when the applet closes. 我的小程序现在在本地运行,但是为了正常工作,它需要在小程序打开时读取一个.ser文件,并在小程序关闭时更新该文件。 The file is quite large (~180 MB), though I am working on paring it down. 该文件非常大(〜180 MB),尽管我正在努力进行缩减。
What would be the fastest/most effective way to read/write this file in java? 用Java读取/写入此文件的最快/最有效的方法是什么? There is a lot of information out there on this and I have never done anything like it before, so it's a bit overwhelming. 那里有很多信息,我以前从未做过类似的事情,所以有点让人不知所措。 The class HTTPURLConnection seems like an option to read it, but not write it. HTTPURLConnection类似乎是读取但不写入的选项。 Any free web hosting that I have seen will not allow a file that big to be uploaded. 我见过的任何免费虚拟主机都不允许上传这么大的文件。
The size of the file should hopefully go down substantially, it is a list of 2.8 million musical artists, many of which I'm sure nobody using the program will ever encounter, but if this program is to be effective, many artists will have to be stored, so the problem most likely remains the same. 希望该文件的大小会大大减少,它是一个280万音乐艺术家的列表,我相信其中很多人都不会遇到使用该程序的人,但是如果该程序有效,那么许多艺术家将不得不被存储,因此问题很可能保持不变。
Thanks in advance for any help 预先感谢您的任何帮助
It sounds like it would be wise to keep this large data and the processing of it on your server instead of making the applet operate on it. 听起来将大数据及其处理保留在服务器上而不是使applet在其上运行似乎是明智的。 That's because you would avoid each user downloading a large file and processing it. 这是因为您可以避免每个用户下载大文件并进行处理。 If you had a server side piece that the applet could call to get useful information from, then only your server would have to load it, write it, and process it. 如果您有一个可以调用applet来获取有用信息的服务器端部件,那么只有您的服务器才需要加载,编写和处理它。 You could implement a Java servlet, or a PHP program to respond to http requests from your applet in a format that suits the data. 您可以实现Java servlet或PHP程序,以适合数据的格式响应applet的http请求。 I'm assuming that your server can handle either servlets or custom PHP (most can). 我假设您的服务器可以处理servlet或自定义PHP(大多数可以)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.