# Interface HelperTransport

All Known Implementing Classes:
  `NativeSubprocessTransport`

public interface HelperTransport

The abstraction over the `cn1-ble-helper` child process's standard I/O. `HelperBleBackend` speaks the line-delimited JSON protocol through this seam only, so a host that has no operating-system process API (the native Windows/Linux ports, which reach the subprocess through a native bridge) can supply its own implementation, while the JavaSE simulator supplies a subprocess-backed one.

All methods are called from at most one reader thread and the caller thread; implementations must make `readLine()`/`writeLine(String)` and `close()`/`isAlive()` safe for that pairing.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Releases the transport and terminates the child process.
  `boolean`
  `isAlive()`
  True while the child process is running.
  `String`
  `readLine()`
  Reads one line of the helper's standard output, blocking until a line is available.
  `void`
  `start(List<String> command)`
  Launches the helper.
  `void`
  `writeLine(String line)`
  Writes one command line to the helper's standard input.

- ## Method Details

  - ### start

    void start(List<String> command) throws IOException
    Launches the helper. `command` is the launch command line (the resolved helper binary path, optionally with arguments). A transport that was pre-configured with its own command by its factory may ignore a `null` argument and launch that instead.
    Parameters:
      `command` - the launch command line, or `null` to use the transport's pre-configured command
    Throws:
      `IOException` - when the child process cannot be started

  - ### readLine

    String readLine() throws IOException
    Reads one line of the helper's standard output, blocking until a line is available.
    Returns:
      the next line without its terminator, or `null` at end of stream (the helper closed stdout / exited)
    Throws:
      `IOException` - when the pipe fails

  - ### writeLine

    void writeLine(String line) throws IOException
    Writes one command line to the helper's standard input. The line terminator is appended by the transport and the stream is flushed.
    Parameters:
      `line` - the single-line JSON command, without a terminator
    Throws:
      `IOException` - when the pipe fails

  - ### close

    void close()
    Releases the transport and terminates the child process.

  - ### isAlive

    boolean isAlive()
    True while the child process is running.