March 2019
Intermediate to advanced
242 pages
6h 21m
English
Imagine that you want to download multiple hosted images files without using an FTP client (or similar applications). Don't worry; you can do so by using the HTTP Client, either synchronously or asynchronously.
The code to do so is similar to what you saw in the preceding section; just save the response body bytes to a file with an appropriate file extension.
The following code downloads three hosted images from eJavaGuru (http://ejavaguru.com/) to the same folder as your source code file:
class MultipleImageDownload{ public static void main(String args[]) throws Exception { List<URI> imageURIs = List.of( URI.create("http://ejavaguru.com/images/about/jbcn-actual-2018.jpg"), URI.create("http://ejavaguru.com/images/about/iit-delhi.jpg"), ...Read now
Unlock full access