Class ExternalProblem.Instance

java.lang.Object
org.moeaframework.problem.ExternalProblem.Instance
All Implemented Interfaces:
Closeable, AutoCloseable
Enclosing class:
ExternalProblem

protected static class ExternalProblem.Instance extends Object implements Closeable
Instance of the external problem. This manages the lifecycle of the process and connections.
  • Constructor Details

    • Instance

      public Instance(ExternalProblem.Builder builder)
      Constructs an instance of an external problem.
      Parameters:
      builder - the builder
  • Method Details

    • isStarted

      public boolean isStarted()
      Returns true if the underlying process or connections are established; false otherwise.
      Returns:
      true if the underlying process or connections are established; false otherwise
    • start

      public void start() throws IOException
      Starts the underlying process and establishes any connections.
      Throws:
      IOException - if an I/O error occurred
    • getReader

      public BufferedReader getReader()
      Returns the reader used to read content from the external problem.
      Returns:
      the reader
    • getWriter

      public BufferedWriter getWriter()
      Returns the writer used to write content to the external problem.
      Returns:
      the writer
    • getDebug

      public PrintStream getDebug()
      Returns the stream where debugging logs are written.
      Returns:
      the debug stream
    • getProcess

      public Process getProcess()
      Returns the underlying process, primarily intended for testing purposes.
      Returns:
      the underlying process, or null if there is none
    • getSocket

      public Socket getSocket()
      Returns the underlying socket, primarily intended for testing purposes.
      Returns:
      the underlying socket, or null if there is none
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException