OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [java/] [lang/] [Win32Process.java] - Blame information for rev 848

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 758 jeremybenn
// Win32Process.java - Subclass of Process for Win32 systems.
2
 
3
/* Copyright (C) 2002, 2003, 2006, 2007  Free Software Foundation
4
 
5
   This file is part of libgcj.
6
 
7
This software is copyrighted work licensed under the terms of the
8
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
9
details.  */
10
 
11
package java.lang;
12
 
13
import java.io.File;
14
import java.io.InputStream;
15
import java.io.OutputStream;
16
import java.io.IOException;
17
 
18
/**
19
 * @author Adam Megacz
20
 * @date Feb 24, 2002
21
 */
22
 
23
// This is entirely internal to our implementation.
24
 
25
final class Win32Process extends Process
26
{
27
  public native void destroy ();
28
 
29
  public int exitValue ()
30
  {
31
    if (! hasExited ())
32
      throw new IllegalThreadStateException ("Process has not exited");
33
 
34
    return exitCode;
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
  public Win32Process (String[] progarray, String[] envp, File dir,
55
                       boolean redirect)
56
    throws IOException
57
  {
58
    for (int i = 0; i < progarray.length; i++)
59
      {
60
        String s = progarray[i];
61
 
62
        if ( (s.indexOf (' ') >= 0) || (s.indexOf ('\t') >= 0))
63
          progarray[i] = "\"" + s + "\"";
64
      }
65
 
66
    startProcess (progarray, envp, dir, redirect);
67
  }
68
 
69
  // The standard streams (stdin, stdout and stderr, respectively)
70
  // of the child as seen by the parent process.
71
  private OutputStream outputStream;
72
  private InputStream inputStream;
73
  private InputStream errorStream;
74
 
75
  // Handle to the child process - cast to HANDLE before use.
76
  private int procHandle;
77
 
78
  // Exit code of the child if it has exited.
79
  private int exitCode;
80
 
81
  private native boolean hasExited ();
82
  private native void startProcess (String[] progarray,
83
                                    String[] envp,
84
                                    File dir,
85
                                    boolean redirect)
86
    throws IOException;
87
  private native void cleanup ();
88
 
89
  private static class EOFInputStream extends InputStream
90
  {
91
    static EOFInputStream instance = new EOFInputStream();
92
    public int read()
93
    {
94
      return -1;
95
    }
96
  }
97
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.