8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /* @test
25 * @bug 5006520
26 * @summary Check many different ways to run Windows programs
27 * @author Martin Buchholz
28 */
29
30 import java.io.*;
31 import java.util.*;
32 import static java.lang.System.*;
33
34 class StreamDrainer extends Thread {
35 private final InputStream is;
36 private final ByteArrayOutputStream os = new ByteArrayOutputStream();
37 public StreamDrainer(InputStream is) { this.is = is; }
38 public void run() {
39 try {
40 int i;
41 while ((i = is.read()) >= 0)
42 os.write(i);
43 } catch (Exception e) {}
44 }
45 public String toString() { return os.toString(); }
46 }
47
|
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /* @test
25 * @bug 5006520
26 * @summary Check many different ways to run Windows programs
27 * @author Martin Buchholz
28 * @key randomness
29 */
30
31 import java.io.*;
32 import java.util.*;
33 import static java.lang.System.*;
34
35 class StreamDrainer extends Thread {
36 private final InputStream is;
37 private final ByteArrayOutputStream os = new ByteArrayOutputStream();
38 public StreamDrainer(InputStream is) { this.is = is; }
39 public void run() {
40 try {
41 int i;
42 while ((i = is.read()) >= 0)
43 os.write(i);
44 } catch (Exception e) {}
45 }
46 public String toString() { return os.toString(); }
47 }
48
|