Topic: Iterator implementation by data from URL
Let's assume that the following code loads a collection of homogeneous objects in JSON or XML: Parser parser = new Parser (new URL ("https://example.com/api/endpoint").openStream ()); For each object from a collection any logic which can occupy about one minute is fulfilled. Thus a parcer stream. The interface of all loading process and decoding turns around in java.util. Iterator, and the code of performance of logic, accordingly, will use methods hasNext () and next (). What happens, if the server without waited, while the data will be completely sent, connection? Or better to say, URL:: openStream returns InputStream which data is completely read out in storage? Or the data on a network is transferred on time to proportionally calls InputStream:: read?