home *** CD-ROM | disk | FTP | other *** search
/ Java Programmer's Toolkit / Java Programmer's Toolkit.iso / solaris2 / jdk / src / java / lang / process.jav < prev    next >
Encoding:
Text File  |  1995-10-30  |  2.6 KB  |  78 lines

  1. /*
  2.  * @(#)Process.java    1.5 95/09/08 Chris Warth
  3.  *
  4.  * Copyright (c) 1994 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software
  7.  * and its documentation for NON-COMMERCIAL purposes and without
  8.  * fee is hereby granted provided that this copyright notice
  9.  * appears in all copies. Please refer to the file "copyright.html"
  10.  * for further important copyright and licensing information.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  13.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  14.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  15.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  16.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  17.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  18.  */
  19.  
  20. package java.lang;
  21.  
  22. import java.io.*;
  23.  
  24. /** 
  25.  * An instance of class Process is returned by variants of the exec
  26.  * method in class System.  From the Process instance, it is
  27.  * possible to: get the standin and/or standout of the subprocess,
  28.  * kill the subprocess, wait for it to terminate, and to
  29.  * retrieve the final exit value of the process.
  30.  * <p>
  31.  * Dropping the last reference to a Process instance does *not*
  32.  * kill the subprocess.  There is no requirement that the
  33.  * subprocess execute asynchronously with the existing Java process.
  34.  */
  35. public abstract class Process 
  36. {
  37.     /**
  38.      * Returns a Stream connected to the input of the child process. 
  39.      * This stream is traditionally buffered.
  40.      */
  41.     abstract public OutputStream getOutputStream();
  42.     
  43.  
  44.     /** 
  45.      * Returns a Stream connected to the output of the child process. 
  46.      * This stream is traditionally buffered. 
  47.      */
  48.     abstract public InputStream getInputStream();
  49.  
  50.     /**
  51.      * Returns the an InputStream connected to the error stream of the child process. 
  52.      * This stream is traditionally unbuffered.
  53.      */
  54.     abstract public InputStream getErrorStream();
  55.  
  56.     /**
  57.      * Waits for the subprocess to complete.  If the subprocess has
  58.      * already terminated the exit value is simply returned.  If the
  59.      * subprocess has not yet terminated the calling thread will be
  60.      * blocked until the subprocess exits.
  61.      *
  62.      * Should this be called join()?
  63.      */
  64.     abstract public int waitFor() throws InterruptedException;
  65.  
  66.    /**
  67.     * Returns the exit value for the subprocess.
  68.     * @exception IllegalThreadStateException If the subprocess has not yet
  69.     * terminated.
  70.     */
  71.     abstract public int exitValue();
  72.  
  73.    /**
  74.     * Kills the subprocess.
  75.     */
  76.     abstract public void destroy();
  77. }
  78.