0

Hi.

I've built a HttpServlet that catch a request and parse a web page using InputStream, InputStreamReader and PrintWriter changing some content along the way and output it as a response. Everything works like a charm (parsing html, css, gif, jpg, aso) except for png images.

Since png's are binary files (correct me if I'm wrong) my guess is i need to use something other than InputStream, InputStreamReader and PrintWriter to parse the png's. But what and how do I use it?

Thanks in advance.

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by AlbertPi
0

Hi.

I've built a HttpServlet that catch a request and parse a web page using InputStream, InputStreamReader and PrintWriter changing some content along the way and output it as a response. Everything works like a charm (parsing html, css, gif, jpg, aso) except for png images.

Since png's are binary files (correct me if I'm wrong) my guess is i need to use something other than InputStream, InputStreamReader and PrintWriter to parse the png's. But what and how do I use it?

Thanks in advance.

Using ByteArrayInputStream to read a bindary file and then use InputStreamReader & BufferedReader. Also careful about "position". These will work.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.