home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / java.z / Process.java < prev    next >
Text File  |  1996-05-03  |  3KB  |  79 lines

  1. /*
  2.  * @(#)Process.java    1.7 95/12/22 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.      * @exception InterruptedException 
  63.      *            Another thread has interrupted this thread. 
  64.      */
  65.     abstract public int waitFor() throws InterruptedException;
  66.  
  67.    /**
  68.     * Returns the exit value for the subprocess.
  69.     * @exception IllegalThreadStateException If the subprocess has not yet
  70.     * terminated.
  71.     */
  72.     abstract public int exitValue();
  73.  
  74.    /**
  75.     * Kills the subprocess.
  76.     */
  77.     abstract public void destroy();
  78. }
  79.