I’m trying to use a BufferedInputStream to load an external DICOM file, but it eventually runs out of memory. When I used an InputStream, this never came up (I did this when I was loading the file through the assets folder).
I created my own producer-consumer threads to buffer the file, so I don’t actually need the BufferedInputStream, but I DO need to use mark() and reset() which is not available in FileInputStream.
How should I go around this? Is there another kind of InputStream that I can use with a File which has the mark()/reset() functions? Can I empty the buffer somehow before the BufferedInputStream throws the error? Or should I find a way around using mark() instead?
Thanks for your input.
For
markandresetto work with buffered input the file points between themarkandresetneed to remain in memory.Workarounds depend on what you’re actually trying to do; if you just need to start reading from a known location, perhaps a
RandomAccessFile.