]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CaptureStreamHandler.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Source / Cpptasks / net / sf / antcontrib / cpptasks / compiler / CaptureStreamHandler.java
diff --git a/Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CaptureStreamHandler.java b/Tools/Source/Cpptasks/net/sf/antcontrib/cpptasks/compiler/CaptureStreamHandler.java
deleted file mode 100644 (file)
index 1b89a70..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*\r
- * \r
- * Copyright 2001-2004 The Ant-Contrib project\r
- *\r
- *  Licensed under the Apache License, Version 2.0 (the "License");\r
- *  you may not use this file except in compliance with the License.\r
- *  You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- *  Unless required by applicable law or agreed to in writing, software\r
- *  distributed under the License is distributed on an "AS IS" BASIS,\r
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- *  See the License for the specific language governing permissions and\r
- *  limitations under the License.\r
- */\r
-package net.sf.antcontrib.cpptasks.compiler;\r
-import java.io.BufferedReader;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.io.InputStreamReader;\r
-import java.io.OutputStream;\r
-import java.util.Vector;\r
-\r
-import org.apache.tools.ant.taskdefs.Execute;\r
-import org.apache.tools.ant.taskdefs.ExecuteStreamHandler;\r
-/**\r
- * Implements ExecuteStreamHandler to capture the output of a Execute to an\r
- * array of strings\r
- * \r
- * @author Curt Arnold\r
- */\r
-public class CaptureStreamHandler implements ExecuteStreamHandler {\r
-    /**\r
-     * Runs an executable and captures the output in a String array\r
-     * \r
-     * @param cmdline\r
-     *            command line arguments\r
-     * @return output of process\r
-     */\r
-    public static String[] run(String[] cmdline) {\r
-        CaptureStreamHandler handler = new CaptureStreamHandler();\r
-        Execute exec = new Execute(handler);\r
-        exec.setCommandline(cmdline);\r
-        try {\r
-            int status = exec.execute();\r
-        } catch (IOException ex) {\r
-        }\r
-        return handler.getOutput();\r
-    }\r
-    private InputStream errorStream;\r
-    private InputStream fromProcess;\r
-    public CaptureStreamHandler() {\r
-    }\r
-    public String[] getOutput() {\r
-        String[] output;\r
-        if (fromProcess != null) {\r
-            Vector lines = new Vector(10);\r
-            try {\r
-                BufferedReader reader = new BufferedReader(\r
-                        new InputStreamReader(errorStream));\r
-                for (int i = 0; i < 2; i++) {\r
-                    for (int j = 0; j < 100; j++) {\r
-                        String line = reader.readLine();\r
-                        if (line == null) {\r
-                            reader = new BufferedReader(new InputStreamReader(\r
-                                    fromProcess));\r
-                            break;\r
-                        }\r
-                        lines.addElement(line);\r
-                    }\r
-                }\r
-            } catch (IOException ex) {\r
-            }\r
-            output = new String[lines.size()];\r
-            lines.copyInto(output);\r
-            return output;\r
-        }\r
-        output = new String[0];\r
-        return output;\r
-    }\r
-    /**\r
-     * Install a handler for the error stream of the subprocess.\r
-     * \r
-     * @param is\r
-     *            input stream to read from the error stream from the\r
-     *            subprocess\r
-     */\r
-    public void setProcessErrorStream(InputStream is) throws IOException {\r
-        errorStream = is;\r
-    }\r
-    /**\r
-     * Install a handler for the input stream of the subprocess.\r
-     * \r
-     * @param os\r
-     *            output stream to write to the standard input stream of the\r
-     *            subprocess\r
-     */\r
-    public void setProcessInputStream(OutputStream os) throws IOException {\r
-        os.close();\r
-    }\r
-    /**\r
-     * Install a handler for the output stream of the subprocess.\r
-     * \r
-     * @param is\r
-     *            input stream to read from the error stream from the\r
-     *            subprocess\r
-     */\r
-    public void setProcessOutputStream(InputStream is) throws IOException {\r
-        fromProcess = is;\r
-    }\r
-    /**\r
-     * Start handling of the streams.\r
-     */\r
-    public void start() throws IOException {\r
-    }\r
-    /**\r
-     * Stop handling of the streams - will not be restarted.\r
-     */\r
-    public void stop() {\r
-    }\r
-}\r