Forums Register Login

Spotting changes to a MappedByteBuffer

+Pie Number of slices to send: Send
I am reading large volumes of data from a file into a charting application. As the source file can be tens of MB and data for a single chart display can be several hundred KB, it makes sense to me to use a MappedByteBuffer (MBB). No problem so far.

The data from this MBB then needs to be parsed and converted into chart-friendly format. Again, no problem.

However, my chart display is intended to update in real-time as new data arrives (i.e. as new data is added to the end of the original data file from an extrenal source). So what I'd really like is to be notified whenever the MBB changes, so that I can then interrogate the change to decide whether or not to update the chart currently visible on-screen. Given that most of my work is Swing-related, I was looking for something along the lines of a MBB.addChangeListener() method or similar, but no such thing exists. I'd prefer not to have to set up a dedicated thread to monitor the MBB constantly if a cleaner solution already exists somewhere within the API. I've also looked at "listeners" in RandomAccessFile and FileChannel, both of which I use to back the MBB, but so far to no avail.

Does anyone have any smart ideas?

Thanks for your help.
This is my favorite show. And this is my favorite tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 690 times.
Similar Threads
nio package and memory mapped interface
Anyone familiar with JFreeChart?
What's wrong with renameTo()?
MappedByteBuffers on 32-bit vs. 64-bit systems
how to resolve Data file
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 08:27:47.