Reputation: 353
I have been looking at the Java Doc, and could not clarify about the validity of the URLConnection method.
My Question is that if I want to download multiple files whose URL only differ by the file name, then do I still need to open connection on each URL ?
Thanks
Upvotes: 2
Views: 331
Reputation: 432
I believe the answer is Yes you are required to open a connection on each URL. As far as I know there is no way to connect to a base URL and then request to read separate file names. Maybe there is a way to do this, but all of the methods in URLConnection
(ie getInputStream()
) takes no parameters - so I don't see a way of requesting a specific resource other than opening a new connection.
Upvotes: 1