source: trunk/src/gcc/libjava/java/lang/PosixProcess.java@ 2

Last change on this file since 2 was 2, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.9 KB
Line 
1// PosixProcess.java - Subclass of Process for POSIX systems.
2
3/* Copyright (C) 1998, 1999 Free Software Foundation
4
5 This file is part of libgcj.
6
7This software is copyrighted work licensed under the terms of the
8Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9details. */
10
11package java.lang;
12
13import java.io.InputStream;
14import java.io.OutputStream;
15import java.io.IOException;
16
17/**
18 * @author Tom Tromey <[email protected]>
19 * @date May 3, 1999
20 */
21
22// This is entirely internal to our implementation.
23
24// This file is copied to `ConcreteProcess.java' before compilation.
25// Hence the class name apparently does not match the file name.
26final class ConcreteProcess extends Process
27{
28 public native void destroy ();
29
30 public int exitValue ()
31 {
32 if (! hasExited)
33 throw new IllegalThreadStateException("Process has not exited");
34 return status;
35 }
36
37 public InputStream getErrorStream ()
38 {
39 return errorStream;
40 }
41
42 public InputStream getInputStream ()
43 {
44 return inputStream;
45 }
46
47 public OutputStream getOutputStream ()
48 {
49 return outputStream;
50 }
51
52 public native int waitFor () throws InterruptedException;
53
54 // This is used for actual initialization, as we can't write a
55 // native constructor.
56 public native void startProcess (String[] progarray, String[] envp)
57 throws IOException;
58
59 // This file is copied to `ConcreteProcess.java' before
60 // compilation. Hence the constructor name apparently does not
61 // match the file name.
62 public ConcreteProcess (String[] progarray, String[] envp) throws IOException
63 {
64 startProcess (progarray, envp);
65 }
66
67 // The process id. This is cast to a pid_t on the native side.
68 private long pid;
69
70 // True when child has exited.
71 private boolean hasExited;
72
73 // The exit status, if the child has exited.
74 private int status;
75
76 // The streams.
77 private InputStream errorStream;
78 private InputStream inputStream;
79 private OutputStream outputStream;
80}
Note: See TracBrowser for help on using the repository browser.