Java Piping

For my assignment, we are supposed to "pipe" the standard output of a class into the standard input of another class(of course w/ more stuff, but that is not where I am having the difficult), but I am having trouble finding any examples on how piping works and how you actually read the standard output and input. Does anyone know of any good sites?

Thank You for the help.

[386 byte] By [semmem1a] at [2007-10-3 5:00:19]
# 1
Have a look at the API docs for the PipedInputStream and the PipedOutputStream.On top of that, nothing forbids you to implement your own streams aslong as they extend the basic abstract InputStream and OutputStreamkind regards,Jos
JosAHa at 2007-7-14 23:05:49 > top of Java-index,Java Essentials,Java Programming...
# 2
Or the straightforward way to do it is at the command line:java PipeDataFromMe | java PipeDataToMe
DrClapa at 2007-7-14 23:05:49 > top of Java-index,Java Essentials,Java Programming...
# 3
> Or the straightforward way to do it is at the command line:> java PipeDataFromMe | java PipeDataToMeYou are so perverted ... ;-)kind regards,Jos
JosAHa at 2007-7-14 23:05:49 > top of Java-index,Java Essentials,Java Programming...
# 4

> > Or the straightforward way to do it is at the

> command line:> java PipeDataFromMe | java

> PipeDataToMe

> You are so perverted ... ;-)

I can't help it. They made me go to this Unix course. It was really scary. Okay, I said, just this one grep. But all the cool guys were doing awk and before I knew it I was doing 5 pipes at a time.

DrClapa at 2007-7-14 23:05:49 > top of Java-index,Java Essentials,Java Programming...
# 5

> > > Or the straightforward way to do it is at the

> > command line:> java PipeDataFromMe | java

> > PipeDataToMe

> > You are so perverted ... ;-)

>

> I can't help it. They made me go to this Unix course.

> It was really scary. Okay, I said, just this one

> grep. But all the cool guys were doing awk and before

> I knew it I was doing 5 pipes at a time.

Oh, wow, man. Hear what he sed. I want to find someone to give me some pipes. And, just remember, less is more.

I also need to know. Why are you guys doing so much redirection? (>)

?{?

sharkuraa at 2007-7-14 23:05:49 > top of Java-index,Java Essentials,Java Programming...
# 6

You read standard input from System.in, and you write standard output to System.out.

Classes don't have standard input and standard output. Processes do. The running JVM is in a process, which is why you have in and out available from System. So it doesn't make sense talking about piping "standard output" from one class into the in of another, unless they're running in separate processes like DrClap showed you. You can pipe input and output streams like JosAH showed you, but keep in mind that that's not necessary "standard input" and "standard output".

So my guess is that your teacher used the wrong terms, or you misunderstood him/her.

paulcwa at 2007-7-14 23:05:49 > top of Java-index,Java Essentials,Java Programming...
# 7
> But all the cool guys were doing awkAwk? Real men use POSIX-compatible sh builtins.
YAT_Archivista at 2007-7-14 23:05:49 > top of Java-index,Java Essentials,Java Programming...