I am struggling with handling stdin and stdout in Ruby.

A java application I have responds works as a helper for an external 
application by doing the following:

in = new BufferedReader(new InputStreamReader(System.in));
out = new PrintStream(System.out, true);

while((stream = in.readLine()).length() != 0) {
....
}

How can this be done in Ruby?

Any help would be grealy appreciated.

-- 
Posted via http://www.ruby-forum.com/.