org.apache.tools.ant.taskdefs.optional.perforce

## Class P4HandlerAdapter

- java.lang.Object
- - org.apache.tools.ant.taskdefs.optional.perforce.P4HandlerAdapter

- All Implemented Interfaces:
    ExecuteStreamHandler, P4Handler
  Direct Known Subclasses:
    SimpleP4OutputHandler

      public abstract class P4HandlerAdapter
      extends java.lang.Object
      implements P4Handler

  base class to manage streams around the execution of the Perforce command line client

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `P4HandlerAdapter()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `process(java.lang.String line)` subclasses of P4HandlerAdapter must implement this routine processing of one line of stdout or of stderr
    `void` | `setOutput(java.lang.String p4Input)` set any data to be written to P4's stdin
    `void` | `setProcessErrorStream(java.io.InputStream is)` connects the handler to the stderr of the Perforce process
    `void` | `setProcessInputStream(java.io.OutputStream os)` connects the handler to the input stream into Perforce used indirectly by tasks requiring to send specific standard input such as p4label, p4change
    `void` | `setProcessOutputStream(java.io.InputStream is)` connects the handler to the stdout of the Perforce process
    `void` | `start()` this routine gets called by the execute routine of the Execute class it connects the PumpStreamHandler to the input/output/error streams of the process.
    `void` | `stop()` stops the processing of streams called from P4Base#execP4Command(String command, P4Handler handler)

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### P4HandlerAdapter

          public P4HandlerAdapter()

  - ### Method Detail

    - #### setOutput

          public void setOutput(java.lang.String p4Input)

      set any data to be written to P4's stdin
      Specified by:
        `setOutput` in interface `P4Handler`
      Parameters:
        `p4Input` - the text to write to P4's stdin

    - #### process

          public abstract void process(java.lang.String line)

      subclasses of P4HandlerAdapter must implement this routine processing of one line of stdout or of stderr
      Specified by:
        `process` in interface `P4Handler`
      Parameters:
        `line` - line of stdout or stderr to process

    - #### start

          public void start()
                     throws BuildException

      this routine gets called by the execute routine of the Execute class it connects the PumpStreamHandler to the input/output/error streams of the process.
      Specified by:
        `start` in interface `ExecuteStreamHandler`
      Throws:
        `BuildException` - if there is a error.
      See Also:
        `Execute.execute()`

    - #### stop

          public void stop()

      stops the processing of streams called from P4Base#execP4Command(String command, P4Handler handler)
      Specified by:
        `stop` in interface `ExecuteStreamHandler`
      See Also:
        `P4Base.execP4Command(String, P4Handler)`

    - #### setProcessInputStream

          public void setProcessInputStream(java.io.OutputStream os)
                                     throws java.io.IOException

      connects the handler to the input stream into Perforce used indirectly by tasks requiring to send specific standard input such as p4label, p4change
      Specified by:
        `setProcessInputStream` in interface `ExecuteStreamHandler`
      Parameters:
        `os` - the stream bringing input to the p4 executable
      Throws:
        `java.io.IOException` - under unknown circumstances

    - #### setProcessErrorStream

          public void setProcessErrorStream(java.io.InputStream is)
                                     throws java.io.IOException

      connects the handler to the stderr of the Perforce process
      Specified by:
        `setProcessErrorStream` in interface `ExecuteStreamHandler`
      Parameters:
        `is` - stderr coming from Perforce
      Throws:
        `java.io.IOException` - under unknown circumstances

    - #### setProcessOutputStream

          public void setProcessOutputStream(java.io.InputStream is)
                                      throws java.io.IOException

      connects the handler to the stdout of the Perforce process
      Specified by:
        `setProcessOutputStream` in interface `ExecuteStreamHandler`
      Parameters:
        `is` - stdout coming from Perforce
      Throws:
        `java.io.IOException` - under unknown circumstances