Looking for a bit of guidance…
I have a piece of code that can generate a lot of data over time. I am constantly flushing the latest state to a file and keeping track of the last N blocks that were created, deleting the oldest from memory.
However during runtime I may need to re-load some of these flushed blocks into memory temporarily.
I have a variable tracking the file (File*) and an output stream to the file(FileOutputStream*). I create an input stream for the file just after writing the header data to the output stream (FileInputStream*) - and when I read the input stream - it reports that its size includes that first written block. So far so good.
However as the file is added to, the input stream remains the same size as it was when the FileInputStream was created - ie. I cannot move forward in the file and load data added to the file since the FileInputStream* was created.
One solution I can see consistent with this behaviour is to re-create the input stream when I need it rather than keeping it around for whatever useful state it may contain.
Is there something I am missing somewhere in keeping the streams syncd to the underlying file?
As a related question; FileInputSource - I can create an InputStream from this. How is this different (apart from a few methods) from a FileInputStream created from a File?
Thanks in anticipation