home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / lang / Process.java < prev    next >
Encoding:
Java Source  |  1998-03-20  |  2.8 KB  |  91 lines

  1. /*
  2.  * @(#)Process.java    1.12 98/03/18
  3.  *
  4.  * Copyright 1995-1997 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.lang;
  16.  
  17. import java.io.*;
  18.  
  19. /** 
  20.  * The <code>exec</code> methods return an 
  21.  * instance of a subclass of <code>Process</code> that can be used to 
  22.  * control the process and obtain information about it. 
  23.  * <p>
  24.  * The subprocess is not killed when there are no more references to 
  25.  * the <code>Process</code> object, but rather the subprocess 
  26.  * continues executing asynchronously. 
  27.  *
  28.  * @author  unascribed
  29.  * @version 1.12, 03/18/98
  30.  * @see     java.lang.Runtime#exec(java.lang.String)
  31.  * @see     java.lang.Runtime#exec(java.lang.String, java.lang.String[])
  32.  * @see     java.lang.Runtime#exec(java.lang.String[])
  33.  * @see     java.lang.Runtime#exec(java.lang.String[], java.lang.String[])
  34.  * @since   JDK1.0
  35.  */
  36. public abstract class Process 
  37. {
  38.     /**
  39.      * Gets the output stream of the subprocess.
  40.      * This stream is usually buffered.
  41.      *
  42.      * @return  the output stream connected to the normal input of the
  43.      *          subprocess.
  44.      */
  45.     abstract public OutputStream getOutputStream();
  46.  
  47.     /** 
  48.      * Gets the input stream of the subprocess.
  49.      * This stream is usually buffered.
  50.      *
  51.      * @return  the input stream connected to the normal output of the
  52.      *          subprocess.
  53.      */
  54.     abstract public InputStream getInputStream();
  55.  
  56.     /**
  57.      * Gets the error stream of the subprocess.
  58.      * This stream is usually unbuffered.
  59.      *
  60.      * @return  the input stream connected to the error stream of the
  61.      *          subprocess.
  62.      */
  63.     abstract public InputStream getErrorStream();
  64.  
  65.     /**
  66.      * Waits for the subprocess to complete. This method returns 
  67.      * immediately if the subprocess has already terminated. If the
  68.      * subprocess has not yet terminated, the calling thread will be
  69.      * blocked until the subprocess exits.
  70.      *
  71.      * @return     the exit value of the process.
  72.      * @exception  InterruptedException  if the <code>waitFor</code> was
  73.      *               interrupted.
  74.      */
  75.     abstract public int waitFor() throws InterruptedException;
  76.  
  77.     /**
  78.      * Returns the exit value for the subprocess.
  79.      *
  80.      * @return  the exit value of the subprocess.
  81.      * @exception  IllegalThreadStateException  if the subprocess has not yet
  82.      *               terminated.
  83.      */
  84.     abstract public int exitValue();
  85.  
  86.     /**
  87.      * Kills the subprocess. 
  88.      */
  89.     abstract public void destroy();
  90. }
  91.