Interface Connection

All Superinterfaces:
AutoCloseable

public interface Connection extends AutoCloseable
Represent a connection to either a local/direct/remote Terminal.
Author:
invalid input: '<'a href=mailto:stale.pedersen@jboss.org">Ståle W. Pedersen
  • Method Details

    • device

      Device device()
      Returns:
      type of terminal
    • size

      Size size()
      Returns:
      terminal size
    • getSizeHandler

      Consumer<Size> getSizeHandler()
      Returns:
      Handler that's called when the terminal changes size
    • setSizeHandler

      void setSizeHandler(Consumer<Size> handler)
      Specify size handler that's called when the terminal changes size.
      Parameters:
      handler -
    • getSignalHandler

      Consumer<Signal> getSignalHandler()
      Get SignalHandler. A handler that's called when a Signal is sent to the terminal
      Returns:
      Signal handler
    • setSignalHandler

      void setSignalHandler(Consumer<Signal> handler)
      Specify the signal handler. A handler that's called when a Signal is sent to the terminal
      Parameters:
      handler - signal handler
    • getStdinHandler

      Consumer<int[]> getStdinHandler()
    • setStdinHandler

      void setStdinHandler(Consumer<int[]> handler)
    • stdoutHandler

      Consumer<int[]> stdoutHandler()
      Handler that's called for all output
      Returns:
      output handler
    • setCloseHandler

      void setCloseHandler(Consumer<Void> closeHandler)
      Specify handler that's called when the input stream is closed.
      Parameters:
      closeHandler - handler
    • getCloseHandler

      Consumer<Void> getCloseHandler()
      Returns:
      handler thats called when the input stream is closed.
    • close

      void close()
      Stop reading from the input stream. The stream will be closed and cleanup methods will be called Eg for terminals they will be restored to their original settings. Note that if the reader thread is blocking waiting for data it will wait until either killed or if the input stream is closed.
      Specified by:
      close in interface AutoCloseable
    • close

      default void close(int exit)
    • openBlocking

      void openBlocking()
      Start reading from the input stream using the current thread. The current thread will be blocked while reading/waiting to read from the stream
    • openNonBlocking

      void openNonBlocking()
      Start reading from the input stream in a separate thread. The current thread will continue.
    • put

      boolean put(Capability capability, Object... params)
      Specify terminal settings
      Parameters:
      capability - capability
      params - parameters
      Returns:
      true if the terminal accepted the settings
    • getAttributes

      Attributes getAttributes()
    • setAttributes

      void setAttributes(Attributes attr)
    • inputEncoding

      Charset inputEncoding()
    • outputEncoding

      Charset outputEncoding()
    • supportsAnsi

      boolean supportsAnsi()
    • write

      default Connection write(String s)
      Write a string to the output handler
      Parameters:
      s - string
      Returns:
      this connection
    • enterRawMode

      default Attributes enterRawMode()
    • getCursorPosition

      default Point getCursorPosition()