缓冲区一个大文件;的BufferedInputStream限制到2GB;阵列限制为2 ^ 31字节 [英] Buffer a large file; BufferedInputStream limited to 2gb; Arrays limited to 2^31 bytes

查看:224
本文介绍了缓冲区一个大文件;的BufferedInputStream限制到2GB;阵列限制为2 ^ 31字节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按顺序处理大型文件,我想保持一大块,它在内存,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.

这篇关于缓冲区一个大文件;的BufferedInputStream限制到2GB;阵列限制为2 ^ 31字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆