Hello there,
What does the constructor 1024 for the new object new byte represent. (Be gentle for I am a rookie).
Patrick
Ralph <titojermaine@yahoo.com> wrote:
Sounds like your best bet is to make a pump thread. Basically create a
thread class with a Run method that continually pushes anything waiting
in the input stream to the output. Something like this...
public class PumpThread implements Runnable {
private InputStream in;
private OutputStream out;
public PumpThread(InputStream in, OutputStream out) {
this.in = in;
this.out = out;
}
public void Run() {
byte[] buffer = new byte[1024];
while ((buffer = in.read()) != null) {
out.write(buffer);
}
}
}
I didn't try the code and it's been awhile, so I might've pulled some
reader/writer methods into the streams (or just misused a method or two
all together). It could also probably benefit by adjusting the byte
array size and including a Thread.sleep() (unless you're using a
BufferedReader). Hope that helps.
--- Bill Woodsonwrote:
> Hi All,
>
> I guess I wasn't clear on what I am after. I know how to write
> string and byte data to an output stream. I thought there was a way
> to just direct an input stream directly to an output stream. That is
> really what I was wondering. Oh and thanks Lee for the buy the book
> advice. I of course will, but your suggestion does not really help
> me immediately.
>
> Bill
>
> ----- Original Message -----
> From: Bill Woodson
> To: List AJUG
> Sent: Friday, October 11, 2002 3:30 PM
> Subject: streams
>
>
> Hi All,
>
> I am reading data from an input stream and I want to write it to a
> file. How do I do this?
>
> Thanks,
> Bill
>
>
__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com
Patrick de Albuquerque
Computer Operator
National Asset Management
404-449-7165