Which is the Best Java Web Framework ?

Java Code to get all images from html code


Java Code  to get all images from html code.

regex = Pattern.compile("[http]");
regexMatcher = regex.matcher(htmlParseData.getHtml());
List tr=htmlParseData.getOutgoingUrls();                      
imgUrlCounter=0;
for(i=0;i<tr.size();i++){
          if(tr.get(i).toString().contains(".jpg") || tr.get(i).toString().contains(".jpeg") || tr.get(i).toString().contains(".gif") || tr.get(i).toString().contains(".bmp")){
                   url = new URL(tr.get(i).toString()); 
                   Image image = new ImageIcon(url).getImage();
           }
 }

Related Post

Web Crawler to get all images and emails from websites.
http://www.buggybread.com/2013/01/create-your-own-email-and-image.html

Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner
comments powered by Disqus




×

Try our new Java Interview Questions Search Tool.

There are more than 1000 questions with practice tests.

It's updated daily and It's Awesome.


×

Try our new Java Practice Test tool.

There are more than 200 questions and expanding quickly. It's updated daily and It's Awesome.