1. /*
  2. * Copyright 2000,2002,2004 The Apache Software Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17. package org.apache.tools.ant.taskdefs;
  18. import java.io.IOException;
  19. import java.io.InputStream;
  20. import java.io.OutputStream;
  21. /**
  22. * Used by <code>Execute</code> to handle input and output stream of
  23. * subprocesses.
  24. *
  25. * @since Ant 1.2
  26. */
  27. public interface ExecuteStreamHandler {
  28. /**
  29. * Install a handler for the input stream of the subprocess.
  30. *
  31. * @param os output stream to write to the standard input stream of the
  32. * subprocess
  33. */
  34. void setProcessInputStream(OutputStream os) throws IOException;
  35. /**
  36. * Install a handler for the error stream of the subprocess.
  37. *
  38. * @param is input stream to read from the error stream from the subprocess
  39. */
  40. void setProcessErrorStream(InputStream is) throws IOException;
  41. /**
  42. * Install a handler for the output stream of the subprocess.
  43. *
  44. * @param is input stream to read from the error stream from the subprocess
  45. */
  46. void setProcessOutputStream(InputStream is) throws IOException;
  47. /**
  48. * Start handling of the streams.
  49. */
  50. void start() throws IOException;
  51. /**
  52. * Stop handling of the streams - will not be restarted.
  53. */
  54. void stop();
  55. }