Class JansiTerminalProvider

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Pty current​(SystemStream systemStream)  
      static int getJansiMajorVersion()  
      static int getJansiMinorVersion()  
      static boolean isAtLeast​(int major, int minor)  
      boolean isSystemStream​(SystemStream stream)
      Checks if the specified system stream is available on this platform.
      java.lang.String name()
      Returns the name of this terminal provider.
      Terminal newTerminal​(java.lang.String name, java.lang.String type, java.io.InputStream in, java.io.OutputStream out, java.nio.charset.Charset encoding, java.nio.charset.Charset stdinEncoding, java.nio.charset.Charset stdoutEncoding, java.nio.charset.Charset stderrEncoding, Terminal.SignalHandler signalHandler, boolean paused, Attributes attributes, Size size)
      Creates a new terminal with custom input and output streams.
      Pty open​(Attributes attributes, Size size)  
      Terminal posixSysTerminal​(java.lang.String name, java.lang.String type, boolean ansiPassThrough, java.nio.charset.Charset encoding, boolean nativeSignals, Terminal.SignalHandler signalHandler, boolean paused, SystemStream systemStream)  
      Terminal posixSysTerminal​(java.lang.String name, java.lang.String type, boolean ansiPassThrough, java.nio.charset.Charset encoding, java.nio.charset.Charset stdinEncoding, java.nio.charset.Charset stdoutEncoding, java.nio.charset.Charset stderrEncoding, boolean nativeSignals, Terminal.SignalHandler signalHandler, boolean paused, SystemStream systemStream)  
      java.lang.String systemStreamName​(SystemStream stream)
      Returns the name of the specified system stream on this platform.
      int systemStreamWidth​(SystemStream stream)
      Returns the width (number of columns) of the specified system stream.
      Terminal sysTerminal​(java.lang.String name, java.lang.String type, boolean ansiPassThrough, java.nio.charset.Charset encoding, java.nio.charset.Charset stdinEncoding, java.nio.charset.Charset stdoutEncoding, java.nio.charset.Charset stderrEncoding, boolean nativeSignals, Terminal.SignalHandler signalHandler, boolean paused, SystemStream systemStream)
      Creates a terminal connected to a system stream.
      java.lang.String toString()  
      static void verifyAtLeast​(int major, int minor)  
      Terminal winSysTerminal​(java.lang.String name, java.lang.String type, boolean ansiPassThrough, java.nio.charset.Charset encoding, boolean nativeSignals, Terminal.SignalHandler signalHandler, boolean paused, SystemStream systemStream)  
      Terminal winSysTerminal​(java.lang.String name, java.lang.String type, boolean ansiPassThrough, java.nio.charset.Charset encoding, java.nio.charset.Charset stdinEncoding, java.nio.charset.Charset stdoutEncoding, java.nio.charset.Charset stderrEncoding, boolean nativeSignals, Terminal.SignalHandler signalHandler, boolean paused, SystemStream systemStream)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • JansiTerminalProvider

        public JansiTerminalProvider()
    • Method Detail

      • getJansiMajorVersion

        public static int getJansiMajorVersion()
      • getJansiMinorVersion

        public static int getJansiMinorVersion()
      • isAtLeast

        public static boolean isAtLeast​(int major,
                                        int minor)
      • verifyAtLeast

        public static void verifyAtLeast​(int major,
                                         int minor)
      • name

        public java.lang.String name()
        Description copied from interface: TerminalProvider
        Returns the name of this terminal provider.

        The provider name is a unique identifier that can be used to request this specific provider when creating terminals. Common provider names include "ffm", "jni", "jansi", "jna", "exec", and "dumb".

        Specified by:
        name in interface TerminalProvider
        Returns:
        the name of this terminal provider
      • current

        public Pty current​(SystemStream systemStream)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • open

        public Pty open​(Attributes attributes,
                        Size size)
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • sysTerminal

        public Terminal sysTerminal​(java.lang.String name,
                                    java.lang.String type,
                                    boolean ansiPassThrough,
                                    java.nio.charset.Charset encoding,
                                    java.nio.charset.Charset stdinEncoding,
                                    java.nio.charset.Charset stdoutEncoding,
                                    java.nio.charset.Charset stderrEncoding,
                                    boolean nativeSignals,
                                    Terminal.SignalHandler signalHandler,
                                    boolean paused,
                                    SystemStream systemStream)
                             throws java.io.IOException
        Description copied from interface: TerminalProvider
        Creates a terminal connected to a system stream.

        This method creates a terminal that is connected to one of the standard system streams (standard input, standard output, or standard error). Such terminals typically represent the actual terminal window or console that the application is running in.

        Specified by:
        sysTerminal in interface TerminalProvider
        Parameters:
        name - the name of the terminal
        type - the terminal type (e.g., "xterm", "dumb")
        ansiPassThrough - whether to pass through ANSI escape sequences
        encoding - the general character encoding to use
        stdinEncoding - the character encoding to use for standard input
        stdoutEncoding - the character encoding to use for standard output
        stderrEncoding - the character encoding to use for standard error
        nativeSignals - whether to use native signal handling
        signalHandler - the signal handler to use
        paused - whether the terminal should start in a paused state
        systemStream - the system stream to connect to
        Returns:
        a new terminal connected to the specified system stream
        Throws:
        java.io.IOException - if an I/O error occurs
      • winSysTerminal

        public Terminal winSysTerminal​(java.lang.String name,
                                       java.lang.String type,
                                       boolean ansiPassThrough,
                                       java.nio.charset.Charset encoding,
                                       boolean nativeSignals,
                                       Terminal.SignalHandler signalHandler,
                                       boolean paused,
                                       SystemStream systemStream)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • winSysTerminal

        public Terminal winSysTerminal​(java.lang.String name,
                                       java.lang.String type,
                                       boolean ansiPassThrough,
                                       java.nio.charset.Charset encoding,
                                       java.nio.charset.Charset stdinEncoding,
                                       java.nio.charset.Charset stdoutEncoding,
                                       java.nio.charset.Charset stderrEncoding,
                                       boolean nativeSignals,
                                       Terminal.SignalHandler signalHandler,
                                       boolean paused,
                                       SystemStream systemStream)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • posixSysTerminal

        public Terminal posixSysTerminal​(java.lang.String name,
                                         java.lang.String type,
                                         boolean ansiPassThrough,
                                         java.nio.charset.Charset encoding,
                                         boolean nativeSignals,
                                         Terminal.SignalHandler signalHandler,
                                         boolean paused,
                                         SystemStream systemStream)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • posixSysTerminal

        public Terminal posixSysTerminal​(java.lang.String name,
                                         java.lang.String type,
                                         boolean ansiPassThrough,
                                         java.nio.charset.Charset encoding,
                                         java.nio.charset.Charset stdinEncoding,
                                         java.nio.charset.Charset stdoutEncoding,
                                         java.nio.charset.Charset stderrEncoding,
                                         boolean nativeSignals,
                                         Terminal.SignalHandler signalHandler,
                                         boolean paused,
                                         SystemStream systemStream)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • newTerminal

        public Terminal newTerminal​(java.lang.String name,
                                    java.lang.String type,
                                    java.io.InputStream in,
                                    java.io.OutputStream out,
                                    java.nio.charset.Charset encoding,
                                    java.nio.charset.Charset stdinEncoding,
                                    java.nio.charset.Charset stdoutEncoding,
                                    java.nio.charset.Charset stderrEncoding,
                                    Terminal.SignalHandler signalHandler,
                                    boolean paused,
                                    Attributes attributes,
                                    Size size)
                             throws java.io.IOException
        Description copied from interface: TerminalProvider
        Creates a new terminal with custom input and output streams.

        This method creates a terminal that is connected to the specified input and output streams. Such terminals can be used for various purposes, such as connecting to remote terminals over network connections or creating virtual terminals for testing.

        Specified by:
        newTerminal in interface TerminalProvider
        Parameters:
        name - the name of the terminal
        type - the terminal type (e.g., "xterm", "dumb")
        in - the input stream to read from
        out - the output stream to write to
        encoding - the general character encoding to use
        stdinEncoding - the character encoding to use for standard input
        stdoutEncoding - the character encoding to use for standard output
        stderrEncoding - the character encoding to use for standard error
        signalHandler - the signal handler to use
        paused - whether the terminal should start in a paused state
        attributes - the initial terminal attributes
        size - the initial terminal size
        Returns:
        a new terminal connected to the specified streams
        Throws:
        java.io.IOException - if an I/O error occurs
      • isSystemStream

        public boolean isSystemStream​(SystemStream stream)
        Description copied from interface: TerminalProvider
        Checks if the specified system stream is available on this platform.

        This method determines whether the specified system stream (standard input, standard output, or standard error) is available for use on the current platform. Some platforms or environments may restrict access to certain system streams.

        Specified by:
        isSystemStream in interface TerminalProvider
        Parameters:
        stream - the system stream to check
        Returns:
        true if the system stream is available, false otherwise
      • systemStreamName

        public java.lang.String systemStreamName​(SystemStream stream)
        Description copied from interface: TerminalProvider
        Returns the name of the specified system stream on this platform.

        This method returns a platform-specific name or identifier for the specified system stream. The name may be used for display purposes or for accessing the stream through platform-specific APIs.

        Specified by:
        systemStreamName in interface TerminalProvider
        Parameters:
        stream - the system stream
        Returns:
        the name of the system stream on this platform
      • systemStreamWidth

        public int systemStreamWidth​(SystemStream stream)
        Description copied from interface: TerminalProvider
        Returns the width (number of columns) of the specified system stream.

        This method determines the width of the terminal associated with the specified system stream. The width is measured in character cells and represents the number of columns available for display.

        Specified by:
        systemStreamWidth in interface TerminalProvider
        Parameters:
        stream - the system stream
        Returns:
        the width of the system stream in character columns
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object