I have an application, which works with large files (gigabytes). Sometimes I get an outofmemoryerror
exception. Does it help if I wrap InputStream
in BufferedInputStream
? What purpose of BufferedInputStream
? How it works?
Asked
Active
Viewed 120 times
0

WelcomeTo
- 19,843
- 53
- 170
- 286
-
1*"`OutOfMemomy` exception."* No such thing in Java. Please copy/paste these things. – Andrew Thompson Oct 14 '12 at 11:17
-
Relevant: http://stackoverflow.com/questions/2356137/read-large-files-in-java – Zaki Oct 14 '12 at 11:19
1 Answers
2
No, it will not help you with memory consumption. It will help you speed up reading the file if you happen to read it in very small chunks.
What will help you, is not to keep the entire file in memory at once. Just keep the parts you're currently processing.

zmbq
- 38,013
- 14
- 101
- 171