DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Java (http://www.daniweb.com/forums/forum9.html)
-   -   I/O Binary stream (http://www.daniweb.com/forums/thread158351.html)

tte Nov 19th, 2008 2:17 pm
I/O Binary stream
 
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.

AlbertPi Nov 20th, 2008 11:27 am
Re: I/O Binary stream
 
Quote:

Originally Posted by tte (Post 739803)
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.


All times are GMT -4. The time now is 3:50 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC