• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Java downloading a JPG file with BufferedReader

promposive

Senior member
Attached is the code...
It connects to ctrlaltdelete comics website, parses through the html, finds the filename of the latest comic.
It then downloads it and displays to the screen.

Try running the program like:

WebClient >> image.jpg

ALSO, it sets off the system speaker... not sure why, but it is pretty annoying...

Anyone have java experience?
 
1. the jdk has an http client built in, much better than writing http by hand
2. *Reader/*Writer is for text, images are binary. Use Streams.
3. Don't store binary data in strings.
4. You are including the http return headers in your image data.
5. System.out is a PrintWriter so you can't send binary data through it.
 
Any links to the built in http client... Im having trouble finding it... Examples?

Sorry for the hassle, I am new to Java and wanting to get into it more.
 
Back
Top