Class JniTerminalProvider

java.lang.Object
org.jline.terminal.impl.jni.JniTerminalProvider
All Implemented Interfaces:
org.jline.terminal.spi.TerminalProvider

public class JniTerminalProvider extends Object implements org.jline.terminal.spi.TerminalProvider
Terminal provider implementation that uses JNI (Java Native Interface) to access native terminal functionality.

This provider requires the JLine native library to be loaded, which is handled by JLineNativeLoader. The native library provides access to low-level terminal operations that are not available through standard Java APIs.

The native library is automatically loaded when this provider is used. If the library cannot be loaded, the provider will not be available and JLine will fall back to other available providers.

The native library loading can be configured using system properties as documented in JLineNativeLoader.

See Also:
  • JLineNativeLoader
  • TerminalBuilder
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new JNI terminal provider instance and ensures the native library is loaded.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.jline.terminal.spi.Pty
    current(org.jline.terminal.spi.SystemStream systemStream)
     
    boolean
    isPosixSystemStream(org.jline.terminal.spi.SystemStream stream)
     
    boolean
    isSystemStream(org.jline.terminal.spi.SystemStream stream)
     
    boolean
    isWindowsSystemStream(org.jline.terminal.spi.SystemStream stream)
     
     
    org.jline.terminal.Terminal
    newTerminal(String name, String type, InputStream in, OutputStream out, Charset encoding, Charset stdinEncoding, Charset stdoutEncoding, Charset stderrEncoding, org.jline.terminal.Terminal.SignalHandler signalHandler, boolean paused, org.jline.terminal.Attributes attributes, org.jline.terminal.Size size)
     
    org.jline.terminal.spi.Pty
    open(org.jline.terminal.Attributes attributes, org.jline.terminal.Size size)
     
    org.jline.terminal.Terminal
    posixSysTerminal(String name, String type, boolean ansiPassThrough, Charset encoding, boolean nativeSignals, org.jline.terminal.Terminal.SignalHandler signalHandler, boolean paused, org.jline.terminal.spi.SystemStream systemStream)
     
    org.jline.terminal.Terminal
    posixSysTerminal(String name, String type, boolean ansiPassThrough, Charset encoding, Charset stdinEncoding, Charset stdoutEncoding, Charset stderrEncoding, boolean nativeSignals, org.jline.terminal.Terminal.SignalHandler signalHandler, boolean paused, org.jline.terminal.spi.SystemStream systemStream)
     
    systemStreamName(org.jline.terminal.spi.SystemStream stream)
     
    int
    systemStreamWidth(org.jline.terminal.spi.SystemStream stream)
     
    org.jline.terminal.Terminal
    sysTerminal(String name, String type, boolean ansiPassThrough, Charset encoding, Charset stdinEncoding, Charset stdoutEncoding, Charset stderrEncoding, boolean nativeSignals, org.jline.terminal.Terminal.SignalHandler signalHandler, boolean paused, org.jline.terminal.spi.SystemStream systemStream)
     
     
    org.jline.terminal.Terminal
    winSysTerminal(String name, String type, boolean ansiPassThrough, Charset encoding, boolean nativeSignals, org.jline.terminal.Terminal.SignalHandler signalHandler, boolean paused, org.jline.terminal.spi.SystemStream systemStream)
     
    org.jline.terminal.Terminal
    winSysTerminal(String name, String type, boolean ansiPassThrough, Charset encoding, Charset stdinEncoding, Charset stdoutEncoding, Charset stderrEncoding, boolean nativeSignals, org.jline.terminal.Terminal.SignalHandler signalHandler, boolean paused, org.jline.terminal.spi.SystemStream systemStream)
     

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.jline.terminal.spi.TerminalProvider

    newTerminal, sysTerminal
  • Constructor Details

    • JniTerminalProvider

      public JniTerminalProvider()
      Creates a new JNI terminal provider instance and ensures the native library is loaded.

      The constructor initializes the JLine native library using JLineNativeLoader.initialize(). If the native library cannot be loaded, methods in this provider may throw exceptions when used.

  • Method Details

    • name

      public String name()
      Specified by:
      name in interface org.jline.terminal.spi.TerminalProvider
    • current

      public org.jline.terminal.spi.Pty current(org.jline.terminal.spi.SystemStream systemStream) throws IOException
      Throws:
      IOException
    • open

      public org.jline.terminal.spi.Pty open(org.jline.terminal.Attributes attributes, org.jline.terminal.Size size) throws IOException
      Throws:
      IOException
    • sysTerminal

      public org.jline.terminal.Terminal sysTerminal(String name, String type, boolean ansiPassThrough, Charset encoding, Charset stdinEncoding, Charset stdoutEncoding, Charset stderrEncoding, boolean nativeSignals, org.jline.terminal.Terminal.SignalHandler signalHandler, boolean paused, org.jline.terminal.spi.SystemStream systemStream) throws IOException
      Specified by:
      sysTerminal in interface org.jline.terminal.spi.TerminalProvider
      Throws:
      IOException
    • winSysTerminal

      public org.jline.terminal.Terminal winSysTerminal(String name, String type, boolean ansiPassThrough, Charset encoding, boolean nativeSignals, org.jline.terminal.Terminal.SignalHandler signalHandler, boolean paused, org.jline.terminal.spi.SystemStream systemStream) throws IOException
      Throws:
      IOException
    • winSysTerminal

      public org.jline.terminal.Terminal winSysTerminal(String name, String type, boolean ansiPassThrough, Charset encoding, Charset stdinEncoding, Charset stdoutEncoding, Charset stderrEncoding, boolean nativeSignals, org.jline.terminal.Terminal.SignalHandler signalHandler, boolean paused, org.jline.terminal.spi.SystemStream systemStream) throws IOException
      Throws:
      IOException
    • posixSysTerminal

      public org.jline.terminal.Terminal posixSysTerminal(String name, String type, boolean ansiPassThrough, Charset encoding, boolean nativeSignals, org.jline.terminal.Terminal.SignalHandler signalHandler, boolean paused, org.jline.terminal.spi.SystemStream systemStream) throws IOException
      Throws:
      IOException
    • posixSysTerminal

      public org.jline.terminal.Terminal posixSysTerminal(String name, String type, boolean ansiPassThrough, Charset encoding, Charset stdinEncoding, Charset stdoutEncoding, Charset stderrEncoding, boolean nativeSignals, org.jline.terminal.Terminal.SignalHandler signalHandler, boolean paused, org.jline.terminal.spi.SystemStream systemStream) throws IOException
      Throws:
      IOException
    • newTerminal

      public org.jline.terminal.Terminal newTerminal(String name, String type, InputStream in, OutputStream out, Charset encoding, Charset stdinEncoding, Charset stdoutEncoding, Charset stderrEncoding, org.jline.terminal.Terminal.SignalHandler signalHandler, boolean paused, org.jline.terminal.Attributes attributes, org.jline.terminal.Size size) throws IOException
      Specified by:
      newTerminal in interface org.jline.terminal.spi.TerminalProvider
      Throws:
      IOException
    • isSystemStream

      public boolean isSystemStream(org.jline.terminal.spi.SystemStream stream)
      Specified by:
      isSystemStream in interface org.jline.terminal.spi.TerminalProvider
    • isWindowsSystemStream

      public boolean isWindowsSystemStream(org.jline.terminal.spi.SystemStream stream)
    • isPosixSystemStream

      public boolean isPosixSystemStream(org.jline.terminal.spi.SystemStream stream)
    • systemStreamName

      public String systemStreamName(org.jline.terminal.spi.SystemStream stream)
      Specified by:
      systemStreamName in interface org.jline.terminal.spi.TerminalProvider
    • systemStreamWidth

      public int systemStreamWidth(org.jline.terminal.spi.SystemStream stream)
      Specified by:
      systemStreamWidth in interface org.jline.terminal.spi.TerminalProvider
    • toString

      public String toString()
      Overrides:
      toString in class Object