Source Code Cross Referenced for Process.java in  » 6.0-JDK-Core » lang » java » lang » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » lang » java.lang 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 1995-2007 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025
026        package java.lang;
027
028        import java.io.*;
029
030        /**
031         * The {@link ProcessBuilder#start()} and
032         * {@link Runtime#exec(String[],String[],File) Runtime.exec}
033         * methods create a native process and return an instance of a
034         * subclass of {@code Process} that can be used to control the process
035         * and obtain information about it.  The class {@code Process}
036         * provides methods for performing input from the process, performing
037         * output to the process, waiting for the process to complete,
038         * checking the exit status of the process, and destroying (killing)
039         * the process.
040         *
041         * <p>The methods that create processes may not work well for special
042         * processes on certain native platforms, such as native windowing
043         * processes, daemon processes, Win16/DOS processes on Microsoft
044         * Windows, or shell scripts.  The created subprocess does not have
045         * its own terminal or console.  All its standard I/O (i.e. stdin,
046         * stdout, stderr) operations will be redirected to the parent process
047         * through three streams
048         * ({@link #getOutputStream()},
049         * {@link #getInputStream()},
050         * {@link #getErrorStream()}).
051         * The parent process uses these streams to feed input to and get output
052         * from the subprocess.  Because some native platforms only provide
053         * limited buffer size for standard input and output streams, failure
054         * to promptly write the input stream or read the output stream of
055         * the subprocess may cause the subprocess to block, and even deadlock.
056         *
057         * <p>The subprocess is not killed when there are no more references to
058         * the {@code Process} object, but rather the subprocess
059         * continues executing asynchronously.
060         *
061         * <p>There is no requirement that a process represented by a {@code
062         * Process} object execute asynchronously or concurrently with respect
063         * to the Java process that owns the {@code Process} object.
064         *
065         * @author  unascribed
066         * @version 1.32, 07/08/07
067         * @see     ProcessBuilder
068         * @since   JDK1.0
069         */
070        public abstract class Process {
071            /**
072             * Returns the output stream connected to the normal input of the
073             * subprocess.  Output to the stream is piped into the standard
074             * input stream of the process represented by this {@code Process}
075             * object.
076             *
077             * <p>Implementation note: It is a good idea for the returned
078             * output stream to be buffered.
079             *
080             * @return the output stream connected to the normal input of the
081             *         subprocess
082             */
083            abstract public OutputStream getOutputStream();
084
085            /**
086             * Returns the input stream connected to the normal output of the
087             * subprocess.  The stream obtains data piped from the standard
088             * output stream of the process represented by this {@code
089             * Process} object.
090             *
091             * <p>Implementation note: It is a good idea for the returned
092             * input stream to be buffered.
093             *
094             * @return the input stream connected to the normal output of the
095             *         subprocess
096             * @see ProcessBuilder#redirectErrorStream()
097             */
098            abstract public InputStream getInputStream();
099
100            /**
101             * Returns the input stream connected to the error output stream of
102             * the subprocess.  The stream obtains data piped from the error
103             * output stream of the process represented by this {@code Process}
104             * object.
105             *
106             * <p>Implementation note: It is a good idea for the returned
107             * input stream to be buffered.
108             *
109             * @return the input stream connected to the error output stream of
110             *         the subprocess
111             * @see ProcessBuilder#redirectErrorStream()
112             */
113            abstract public InputStream getErrorStream();
114
115            /**
116             * Causes the current thread to wait, if necessary, until the
117             * process represented by this {@code Process} object has
118             * terminated.  This method returns immediately if the subprocess
119             * has already terminated.  If the subprocess has not yet
120             * terminated, the calling thread will be blocked until the
121             * subprocess exits.
122             *
123             * @return the exit value of the subprocess represented by this
124             *         {@code Process} object.  By convention, the value
125             *         {@code 0} indicates normal termination.
126             * @throws InterruptedException if the current thread is
127             *         {@linkplain Thread#interrupt() interrupted} by another
128             *         thread while it is waiting, then the wait is ended and
129             *         an {@link InterruptedException} is thrown.
130             */
131            abstract public int waitFor() throws InterruptedException;
132
133            /**
134             * Returns the exit value for the subprocess.
135             *
136             * @return the exit value of the subprocess represented by this
137             *         {@code Process} object.  By convention, the value
138             *         {@code 0} indicates normal termination.
139             * @throws IllegalThreadStateException if the subprocess represented
140             *         by this {@code Process} object has not yet terminated
141             */
142            abstract public int exitValue();
143
144            /**
145             * Kills the subprocess. The subprocess represented by this
146             * {@code Process} object is forcibly terminated.
147             */
148            abstract public void destroy();
149        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.