Here is what I need to do. Inside a servlet I have an InputStream that is the result of calling getInputStream on a Process. This is stdout from a C program that I call. I also have an OutputStream. This comes from Response.getOutputStream. What I need to do is pipe the stream from the InputStream through the OutputStream. Any ideas?
Jim Yingst
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18652
posted
0
Write a loop to read bytes from the input stream, and write those bytes to the output stream:
For improved efficiency, modify the loop to use read(byte[]) and write(byte[]) instead. It may well also be useful to put this method in a separate thread.