Package org.fusesource.jansi.internal
Class Kernel32
- java.lang.Object
-
- org.fusesource.jansi.internal.Kernel32
-
public class Kernel32 extends Object
Interface to access Win32 base APIs.- Author:
- Hiram Chirino, Guillaume Nodet
- See Also:
JansiLoader
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Kernel32.CHAR_INFO
see: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682013(v=vs.85).aspxstatic class
Kernel32.CONSOLE_SCREEN_BUFFER_INFO
http://msdn.microsoft.com/en-us/library/ms682093%28VS.85%29.aspxstatic class
Kernel32.COORD
static class
Kernel32.FOCUS_EVENT_RECORD
see: http://msdn.microsoft.com/en-us/library/ms683149(v=VS.85).aspxstatic class
Kernel32.INPUT_RECORD
see: http://msdn.microsoft.com/en-us/library/ms683499(v=VS.85).aspxstatic class
Kernel32.KEY_EVENT_RECORD
see: http://msdn.microsoft.com/en-us/library/ms684166(v=VS.85).aspxstatic class
Kernel32.MENU_EVENT_RECORD
see: http://msdn.microsoft.com/en-us/library/ms684213(v=VS.85).aspxstatic class
Kernel32.MOUSE_EVENT_RECORD
see: http://msdn.microsoft.com/en-us/library/ms684239(v=VS.85).aspxstatic class
Kernel32.SMALL_RECT
http://msdn.microsoft.com/en-us/library/ms686311%28VS.85%29.aspxstatic class
Kernel32.WINDOW_BUFFER_SIZE_RECORD
see: http://msdn.microsoft.com/en-us/library/ms687093(v=VS.85).aspx
-
Field Summary
Fields Modifier and Type Field Description static short
BACKGROUND_BLUE
static short
BACKGROUND_GREEN
static short
BACKGROUND_INTENSITY
static short
BACKGROUND_RED
static short
COMMON_LVB_GRID_HORIZONTAL
static short
COMMON_LVB_GRID_LVERTICAL
static short
COMMON_LVB_GRID_RVERTICAL
static short
COMMON_LVB_LEADING_BYTE
static short
COMMON_LVB_REVERSE_VIDEO
static short
COMMON_LVB_TRAILING_BYTE
static short
COMMON_LVB_UNDERSCORE
static short
FOREGROUND_BLUE
static short
FOREGROUND_GREEN
static short
FOREGROUND_INTENSITY
static short
FOREGROUND_RED
static int
FORMAT_MESSAGE_FROM_SYSTEM
static int
INVALID_HANDLE_VALUE
static int
STD_ERROR_HANDLE
static int
STD_INPUT_HANDLE
static int
STD_OUTPUT_HANDLE
-
Constructor Summary
Constructors Constructor Description Kernel32()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
_getch()
see: http://msdn.microsoft.com/en-us/library/078sfkak(VS.80).aspxstatic int
CloseHandle(long handle)
see: http://msdn.microsoft.com/en-us/library/ms724211%28VS.85%29.aspxstatic int
FillConsoleOutputAttribute(long consoleOutput, short attribute, int length, Kernel32.COORD writeCoord, int[] numberOfAttrsWritten)
see: https://msdn.microsoft.com/en-us/library/ms682662%28VS.85%29.aspxstatic int
FillConsoleOutputCharacterW(long consoleOutput, char character, int length, Kernel32.COORD writeCoord, int[] numberOfCharsWritten)
see: http://msdn.microsoft.com/en-us/library/ms682663%28VS.85%29.aspxstatic int
FlushConsoleInputBuffer(long handle)
see: http://msdn.microsoft.com/en-us/library/ms683147(v=VS.85).aspxstatic int
FormatMessageW(int flags, long source, int messageId, int languageId, byte[] buffer, int size, long[] args)
static void
free(long ptr)
static int
GetConsoleMode(long handle, int[] mode)
see: http://msdn.microsoft.com/en-us/library/ms683167%28VS.85%29.aspxstatic int
GetConsoleOutputCP()
see: http://msdn.microsoft.com/en-us/library/ms683169(v=VS.85).aspxstatic int
GetConsoleScreenBufferInfo(long consoleOutput, Kernel32.CONSOLE_SCREEN_BUFFER_INFO consoleScreenBufferInfo)
See: http://msdn.microsoft.com/en-us/library/ms683171%28VS.85%29.aspxstatic int
GetLastError()
see: http://msdn.microsoft.com/en-us/library/ms679360(VS.85).aspxstatic int
GetNumberOfConsoleInputEvents(long handle, int[] numberOfEvents)
see: http://msdn.microsoft.com/en-us/library/ms683207(v=VS.85).aspxstatic long
GetStdHandle(int stdHandle)
see: http://msdn.microsoft.com/en-us/library/ms683231%28VS.85%29.aspxstatic long
malloc(long size)
static Kernel32.INPUT_RECORD[]
readConsoleInputHelper(long handle, int count, boolean peek)
Return console input events.static Kernel32.INPUT_RECORD[]
readConsoleKeyInput(long handle, int count, boolean peek)
Return console input key events (discard other events).static int
ScrollConsoleScreenBuffer(long consoleOutput, Kernel32.SMALL_RECT scrollRectangle, Kernel32.SMALL_RECT clipRectangle, Kernel32.COORD destinationOrigin, Kernel32.CHAR_INFO fill)
see: https://msdn.microsoft.com/en-us/library/windows/desktop/ms685107(v=vs.85).aspxstatic int
SetConsoleCursorPosition(long consoleOutput, Kernel32.COORD cursorPosition)
http://msdn.microsoft.com/en-us/library/ms686025%28VS.85%29.aspxstatic int
SetConsoleMode(long handle, int mode)
see: http://msdn.microsoft.com/en-us/library/ms686033%28VS.85%29.aspxstatic int
SetConsoleOutputCP(int codePageID)
see: http://msdn.microsoft.com/en-us/library/ms686036(v=VS.85).aspxstatic int
SetConsoleTextAttribute(long consoleOutput, short attributes)
see http://msdn.microsoft.com/en-us/library/ms686047%28VS.85%29.aspxstatic int
SetConsoleTitle(String title)
see: http://msdn.microsoft.com/en-us/library/ms686050%28VS.85%29.aspxstatic int
WaitForSingleObject(long hHandle, int dwMilliseconds)
static int
WriteConsoleW(long consoleOutput, char[] buffer, int numberOfCharsToWrite, int[] numberOfCharsWritten, long reserved)
see: http://msdn.microsoft.com/en-us/library/ms687401(v=VS.85).aspx
-
-
-
Field Detail
-
FOREGROUND_BLUE
public static short FOREGROUND_BLUE
-
FOREGROUND_GREEN
public static short FOREGROUND_GREEN
-
FOREGROUND_RED
public static short FOREGROUND_RED
-
FOREGROUND_INTENSITY
public static short FOREGROUND_INTENSITY
-
BACKGROUND_BLUE
public static short BACKGROUND_BLUE
-
BACKGROUND_GREEN
public static short BACKGROUND_GREEN
-
BACKGROUND_RED
public static short BACKGROUND_RED
-
BACKGROUND_INTENSITY
public static short BACKGROUND_INTENSITY
-
COMMON_LVB_LEADING_BYTE
public static short COMMON_LVB_LEADING_BYTE
-
COMMON_LVB_TRAILING_BYTE
public static short COMMON_LVB_TRAILING_BYTE
-
COMMON_LVB_GRID_HORIZONTAL
public static short COMMON_LVB_GRID_HORIZONTAL
-
COMMON_LVB_GRID_LVERTICAL
public static short COMMON_LVB_GRID_LVERTICAL
-
COMMON_LVB_GRID_RVERTICAL
public static short COMMON_LVB_GRID_RVERTICAL
-
COMMON_LVB_REVERSE_VIDEO
public static short COMMON_LVB_REVERSE_VIDEO
-
COMMON_LVB_UNDERSCORE
public static short COMMON_LVB_UNDERSCORE
-
FORMAT_MESSAGE_FROM_SYSTEM
public static int FORMAT_MESSAGE_FROM_SYSTEM
-
STD_INPUT_HANDLE
public static int STD_INPUT_HANDLE
-
STD_OUTPUT_HANDLE
public static int STD_OUTPUT_HANDLE
-
STD_ERROR_HANDLE
public static int STD_ERROR_HANDLE
-
INVALID_HANDLE_VALUE
public static int INVALID_HANDLE_VALUE
-
-
Constructor Detail
-
Kernel32
public Kernel32()
-
-
Method Detail
-
malloc
public static long malloc(long size)
-
free
public static void free(long ptr)
-
SetConsoleTextAttribute
public static int SetConsoleTextAttribute(long consoleOutput, short attributes)
see http://msdn.microsoft.com/en-us/library/ms686047%28VS.85%29.aspx
-
WaitForSingleObject
public static int WaitForSingleObject(long hHandle, int dwMilliseconds)
-
CloseHandle
public static int CloseHandle(long handle)
see: http://msdn.microsoft.com/en-us/library/ms724211%28VS.85%29.aspx
-
GetLastError
public static int GetLastError()
see: http://msdn.microsoft.com/en-us/library/ms679360(VS.85).aspx
-
FormatMessageW
public static int FormatMessageW(int flags, long source, int messageId, int languageId, byte[] buffer, int size, long[] args)
-
GetConsoleScreenBufferInfo
public static int GetConsoleScreenBufferInfo(long consoleOutput, Kernel32.CONSOLE_SCREEN_BUFFER_INFO consoleScreenBufferInfo)
See: http://msdn.microsoft.com/en-us/library/ms683171%28VS.85%29.aspx
-
GetStdHandle
public static long GetStdHandle(int stdHandle)
see: http://msdn.microsoft.com/en-us/library/ms683231%28VS.85%29.aspx
-
SetConsoleCursorPosition
public static int SetConsoleCursorPosition(long consoleOutput, Kernel32.COORD cursorPosition)
http://msdn.microsoft.com/en-us/library/ms686025%28VS.85%29.aspx
-
FillConsoleOutputCharacterW
public static int FillConsoleOutputCharacterW(long consoleOutput, char character, int length, Kernel32.COORD writeCoord, int[] numberOfCharsWritten)
see: http://msdn.microsoft.com/en-us/library/ms682663%28VS.85%29.aspx
-
FillConsoleOutputAttribute
public static int FillConsoleOutputAttribute(long consoleOutput, short attribute, int length, Kernel32.COORD writeCoord, int[] numberOfAttrsWritten)
see: https://msdn.microsoft.com/en-us/library/ms682662%28VS.85%29.aspx
-
WriteConsoleW
public static int WriteConsoleW(long consoleOutput, char[] buffer, int numberOfCharsToWrite, int[] numberOfCharsWritten, long reserved)
see: http://msdn.microsoft.com/en-us/library/ms687401(v=VS.85).aspx
-
GetConsoleMode
public static int GetConsoleMode(long handle, int[] mode)
see: http://msdn.microsoft.com/en-us/library/ms683167%28VS.85%29.aspx
-
SetConsoleMode
public static int SetConsoleMode(long handle, int mode)
see: http://msdn.microsoft.com/en-us/library/ms686033%28VS.85%29.aspx
-
_getch
public static int _getch()
see: http://msdn.microsoft.com/en-us/library/078sfkak(VS.80).aspx
-
SetConsoleTitle
public static int SetConsoleTitle(String title)
see: http://msdn.microsoft.com/en-us/library/ms686050%28VS.85%29.aspx- Returns:
- 0 if title was set successfully
-
GetConsoleOutputCP
public static int GetConsoleOutputCP()
see: http://msdn.microsoft.com/en-us/library/ms683169(v=VS.85).aspx- Returns:
- the current output code page
-
SetConsoleOutputCP
public static int SetConsoleOutputCP(int codePageID)
see: http://msdn.microsoft.com/en-us/library/ms686036(v=VS.85).aspx- Returns:
- non 0 if code page was set
-
ScrollConsoleScreenBuffer
public static int ScrollConsoleScreenBuffer(long consoleOutput, Kernel32.SMALL_RECT scrollRectangle, Kernel32.SMALL_RECT clipRectangle, Kernel32.COORD destinationOrigin, Kernel32.CHAR_INFO fill)
see: https://msdn.microsoft.com/en-us/library/windows/desktop/ms685107(v=vs.85).aspx
-
GetNumberOfConsoleInputEvents
public static int GetNumberOfConsoleInputEvents(long handle, int[] numberOfEvents)
see: http://msdn.microsoft.com/en-us/library/ms683207(v=VS.85).aspx
-
FlushConsoleInputBuffer
public static int FlushConsoleInputBuffer(long handle)
see: http://msdn.microsoft.com/en-us/library/ms683147(v=VS.85).aspx
-
readConsoleInputHelper
public static Kernel32.INPUT_RECORD[] readConsoleInputHelper(long handle, int count, boolean peek) throws IOException
Return console input events.- Throws:
IOException
-
readConsoleKeyInput
public static Kernel32.INPUT_RECORD[] readConsoleKeyInput(long handle, int count, boolean peek) throws IOException
Return console input key events (discard other events).- Parameters:
count
- requested number of events- Returns:
- array possibly of size smaller then count
- Throws:
IOException
-
-