Package org.aesh.terminal.tty.impl
Class WinConsoleNative
java.lang.Object
org.aesh.terminal.tty.impl.WinConsoleNative
JNI bridge to Windows console API (Kernel32).
Replaces JNA for GraalVM native-image compatibility.
This class provides low-level access to Windows console functions
via JNI. The native library (aesh-console.dll) is loaded
from the system library path or extracted from the JAR at runtime.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConsole mode flag: enable virtual terminal input on input handlestatic final intConsole mode flag: enable virtual terminal processing on output handlestatic final longstatic final intEvent type constants matching Windows INPUT_RECORD.EventTypestatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetConsoleMode(long handle) static intstatic int[]getConsoleSize(long handle) static longgetStdHandle(int nStdHandle) static int[]readConsoleInputEvent(long handle) Read a console input event (key or window resize).static int[]readConsoleKeyEvent(long handle) static booleansetConsoleMode(long handle, int mode) static booleanwriteConsole(long handle, char[] buffer, int length)
-
Field Details
-
STD_INPUT_HANDLE
public static final int STD_INPUT_HANDLE- See Also:
-
STD_OUTPUT_HANDLE
public static final int STD_OUTPUT_HANDLE- See Also:
-
STD_ERROR_HANDLE
public static final int STD_ERROR_HANDLE- See Also:
-
INVALID_HANDLE
public static final long INVALID_HANDLE- See Also:
-
KEY_EVENT
public static final int KEY_EVENTEvent type constants matching Windows INPUT_RECORD.EventType- See Also:
-
WINDOW_BUFFER_SIZE_EVENT
public static final int WINDOW_BUFFER_SIZE_EVENT- See Also:
-
ENABLE_VIRTUAL_TERMINAL_PROCESSING
public static final int ENABLE_VIRTUAL_TERMINAL_PROCESSINGConsole mode flag: enable virtual terminal processing on output handle- See Also:
-
ENABLE_VIRTUAL_TERMINAL_INPUT
public static final int ENABLE_VIRTUAL_TERMINAL_INPUTConsole mode flag: enable virtual terminal input on input handle- See Also:
-
-
Method Details
-
getStdHandle
public static long getStdHandle(int nStdHandle) -
getConsoleMode
public static int getConsoleMode(long handle) -
setConsoleMode
public static boolean setConsoleMode(long handle, int mode) -
getConsoleOutputCP
public static int getConsoleOutputCP() -
getConsoleSize
public static int[] getConsoleSize(long handle) -
readConsoleKeyEvent
public static int[] readConsoleKeyEvent(long handle) -
readConsoleInputEvent
public static int[] readConsoleInputEvent(long handle) Read a console input event (key or window resize). Returns int[] where first element is the event type: KEY_EVENT (1): {1, keyDown, repeatCount, vKeyCode, unicodeChar, controlKeyState} WINDOW_BUFFER_SIZE_EVENT (4): {4, width, height} Returns null for other event types or on error. -
writeConsole
public static boolean writeConsole(long handle, char[] buffer, int length)
-