Java Program to read and download webpage
1. Create a URL object and pass url as string to download the webpage.
URL example = new URL(pass url of webpage you want to download)
2. Create Buffered Reader object and pass openStream(). Method of URL in Input Stream object.
3. Create a string object to read each line one by one from stream.
4. Write each line in html file where webpage will be downloaded.
5. Close all objects.
6. Catch exceptions if url failed to download.
- How to display search result of another page on same page using ajax in JSP?
- How to pass form variables from one page to other page in PHP ?
- How to redirect a page to another page in HTML ?
- How to show Page Loading div until the page has finished loading?
- Download file from URL using PHP
- HTML | download Attribute
- HTML | <a> download Attribute
- HTML | DOM Anchor download Property
- HTML | <area> download Attribute
- How to download Google Images using Python
- YouTube Media/Audio Download using Python | pafy
- Pytube | Python library to download youtube videos
- ES6 | Page Redirect
- ES6 | Page Printing
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.