Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

reading a graphic file.  RSS feed

 
Vivian Ryder
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am building a spider for our company that will need to copy the HTML along with the pictures on the pages. Since I am rather new to Java IO, I was wondering if someone can help me on what type of input stream or reader to use. Perhaps a few lines of snippet will be very helpful.
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless you are displaying the images you would treat them just like every other binary file: Input/OutputStream. Have a look at the Java Tutorial chapter on IO for examples.
 
Vivian Ryder
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you. I just found out about the ImageIO class. Would it be better suited to read in and save an image file such as jpg or png?
[ December 06, 2005: Message edited by: Vivian Ryder ]
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ImageIO API is better suited for reading and writing images in conjunction with processing them, while it seems that you merely need to download and store them, so I would stay away from it.
[ December 06, 2005: Message edited by: Ulf Dittmer ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!