Sky

sky ray clouds park inokashira
by Blue Lotus

開発ブログ

HtmlUnit : pulling down and saving image

はてなブックマーク del.icio.usブックマーク HtmlUnit : pulling down and saving imageをYahoo!ブックマークに追加

Htmlunit doesn't fetch images or put in a right manner HtmlUnit version 1.14 does not

provide a direct method to download and save image but it can possible with following

approach

Lets say you have HtmlPage Object.

final HtmlImage img = pageRP.getXXX // Retrieve the img node here

final Page imagePage = webClient.getPage(pageRP.getFullyQualifiedUrl(img.getSrcAttribute()));

The imagePage will be of type com.gargoylesoftware.htmlunit.UnexpectedPage.

At this point you have access to the binary content of the page.

Now using java.io you can donwload and save image.

--

RS 


.

トラックバック

このエントリーのトラックバックURL:
http://www.sbirobo.com/mt/mt-tb.cgi/913

コメントを投稿

銘柄検索  松本徹三  SBI Business  ソーシャルグラフ  ビジネスSNS