我按顺序处理大型文件,我想保持一大块,它在内存,16GB内存可在64位系统。
I am sequentially processing a large file and I'd like to keep a large chunk of it in memory, 16gb ram available on a 64 bit system.
有一个快速和肮脏的方法是做到这一点,仅仅是包裹输入流中一个缓冲的输入流,遗憾的是,这只是给了我一个2GB的缓冲区。我想在内存中多了吧,我有什么办法?
A quick and dirty way is to do this, is simply wrap the input stream into a buffered input stream, unfortunately, this only gives me a 2gb buffer. I'd like to have more of it in memory, what alternatives do I have?
你有没有考虑在MappedByteBuffer的java.nio?这是在我的头上,但也许这就是你所期待的。
Have you considered the MappedByteBuffer in java.nio? It's over my head but maybe it is what you are looking for.