runCommand with java.io.InputStream

53 views
Skip to first unread message

MICHAEL BLAHAY

unread,
May 13, 2012, 8:31:49 PM5/13/12
to mozill...@googlegroups.com
The Rhino documentation at https://developer.mozilla.org/en/Rhino_Shell states the following about the input property of the options argument to runCommand:

input - the process input. If it is not java.io.InputStream, it is converted to string and sent to the process as its input. If not specified, no input is provided to the process.

What does it mean to use java.io.InputStream and how do you do it? I cannot find any examples of such use.

frank.w...@gmail.com

unread,
May 16, 2012, 5:11:16 AM5/16/12
to mozill...@googlegroups.com
From MICHAEL BLAHAY :
>options argument to runCommand:

>input - the process input. If it is not
>java.io.InputStream, it is
>converted to string and sent to the process as its
>input. If not specified,
>no input is provided to the process.

>What does it mean to use java.io.InputStream and how do
>you do it?

I take it that you aren't familiar with the Java
library. The input to your script can be obtained from
java.lang.System.in, which is a java.io.InputStream, so
you could pass java.lang.System.in as the argument. You
could also create an InputStream from other processes
and other things. I don't use runCommand so I won't
chance giving an erroneous example.

Frank
--
I reply offline so my comments might be tardy.
Reply all
Reply to author
Forward
0 new messages