In java, when we establish a connection to a given URL and then open a stream to read from it, what happens when the content of the website changes halfway through reading?
For instance, our cursor was pointing to at line 1000, which was supposed contain a chapter title, but now the page has something completely different at line 1000, or perhaps the content is no longer as big as 1000 lines?
What happens if a given website updates its content every 1-2 secs, with e.g. stock changes, which might include only stocks that ticked in the last 1 sec (content grows and shrinks)?
The behaviour of what actually happens depends entirely on the web server itself and is outside the control of the client.
Most web servers will send and entire, complete document all at once, as if it were a “snapshot” in time of some particular document state.