001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 *
017 */
018
019 package org.apache.commons.exec;
020
021 import java.io.IOException;
022 import java.io.InputStream;
023 import java.io.OutputStream;
024
025 /**
026 * Used by <code>Execute</code> to handle input and output stream of
027 * subprocesses.
028 */
029 public interface ExecuteStreamHandler {
030
031 /**
032 * Install a handler for the input stream of the subprocess.
033 *
034 * @param os
035 * output stream to write to the standard input stream of the
036 * subprocess
037 */
038 void setProcessInputStream(OutputStream os) throws IOException;
039
040 /**
041 * Install a handler for the error stream of the subprocess.
042 *
043 * @param is
044 * input stream to read from the error stream from the subprocess
045 */
046 void setProcessErrorStream(InputStream is) throws IOException;
047
048 /**
049 * Install a handler for the output stream of the subprocess.
050 *
051 * @param is
052 * input stream to read from the error stream from the subprocess
053 */
054 void setProcessOutputStream(InputStream is) throws IOException;
055
056 /**
057 * Start handling of the streams.
058 */
059 void start() throws IOException;
060
061 /**
062 * Stop handling of the streams - will not be restarted.
063 */
064 void stop();
065 }