Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do Hex editors display data so quickly?

I'v created a Notepad-like application and if I load a 1MB file into the textbox, it takes about 1 minute. The Visual Studio Binary editor displays lines, Hex, and ascii versions in a fraction of a second. How do they get the data into the textbox so quickly? Thanks

like image 460
jmasterx Avatar asked Jan 22 '23 04:01

jmasterx


1 Answers

They only read enough of the file to display what is viewable on screen. In other words, if your UI can only display 100 bytes at a time, you only need to read 100 bytes to fill the screen. If the user scrolls the window, you have to read additional bytes to fill in the missing pieces.

like image 144
Chris Hafey Avatar answered Jan 29 '23 10:01

Chris Hafey