Enum Key

java.lang.Object
java.lang.Enum<Key>
org.aesh.terminal.Key
All Implemented Interfaces:
Serializable, Comparable<Key>, java.lang.constant.Constable, KeyAction

public enum Key extends Enum<Key> implements KeyAction
ANSCII enum key chart
Author:
Ståle W. Pedersen
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Lowercase a key.
    Uppercase A key.
    Ampersand (&) key.
    Apostrophe (') key.
    At (@) key.
    Lowercase b key.
    Uppercase B key.
    Backslash (\) key.
    Backspace key.
    Lowercase c key.
    Uppercase C key.
    Colon (:) key.
    Comma (,) key.
    Control + A key.
    Control + @ key.
    Control + B key.
    Control + C key.
    Control + D key.
    Control + Down arrow key.
    Control + E key.
    Control + F key.
    Control + G key.
    Control + H key.
    Control + I key.
    Control + J key.
    Control + K key.
    Control + L key.
    Control + Left arrow key.
    Control + M key.
    Control + N key.
    Control + O key.
    Control + P key.
    Control + Q key.
    Control + R key.
    Control + Right arrow key.
    Control + S key.
    Control + T key.
    Control + U key.
    Control + Up arrow key.
    Control + V key.
    Control + W key.
    Control + X key.
    Control + X followed by Control + U combination.
    Control + Y key.
    Control + Z key.
    Lowercase d key.
    Uppercase D key.
    Delete key.
    Dollar ($) key.
    Down arrow key.
    Down arrow key (alternate encoding).
    Lowercase e key.
    Uppercase E key.
    Number 8 key.
    End key.
    End key (alternate encoding).
    End key (alternate encoding).
    Enter key.
    Enter key (alternate encoding for Windows CR+LF).
    Equals (=) key.
    Escape key (also Control + [).
    Exclamation mark (!)
    Lowercase f key.
    Uppercase F key.
    File separator key (Control + \).
    Number 5 key.
    Number 4 key.
    Lowercase g key.
    Uppercase G key.
    Grave accent (`) key.
    Greater than (>) key.
    Group separator key (Control + ]).
    Lowercase h key.
    Uppercase H key.
    Hash (#) key.
    Hat (^) key.
    Home key.
    Home key (alternate encoding).
    Home key (alternate encoding).
    Lowercase i key.
    Uppercase I key.
    Insert key.
    Lowercase j key.
    Uppercase J key.
    Lowercase k key.
    Uppercase K key.
    Lowercase l key.
    Uppercase L key.
    Left arrow key.
    Left arrow key (alternate encoding).
    Left curly bracket ({) key.
    Deprecated.
    Use LEFT_PARENTHESIS instead.
    Left parenthesis (() key.
    Left square bracket ([) key.
    Less than (<) key.
    Lowercase m key.
    Uppercase M key.
    Meta (Alt) + a combination.
    Meta (Alt) + b combination.
    Meta (Alt) + Backspace combination.
    Meta (Alt) + c combination.
    Meta (Alt) + Control + D combination.
    Meta (Alt) + Control + J combination.
    Meta (Alt) + d combination.
    Meta (Alt) + e combination.
    Meta (Alt) + f combination.
    Meta (Alt) + l combination.
    Meta (Alt) + Right arrow key.
    Meta (Alt) + t combination.
    Meta (Alt) + u combination.
    Minus (-) key.
    Lowercase n key.
    Uppercase N key.
    Number 9 key.
    Lowercase o key.
    Uppercase O key.
    Number 1 key.
    Lowercase p key.
    Uppercase P key.
    Percent (%) key.
    Period (.) key.
    Page Down key.
    Page Down key (alternate encoding for Solaris).
    Page Up key.
    Page Up key (alternate encoding for Solaris).
    Plus (+) key.
    Lowercase q key.
    Uppercase Q key.
    Question mark (?)
    Quote (") key.
    Lowercase r key.
    Uppercase R key.
    Record separator key (Control + ^).
    Right arrow key.
    Right arrow key (alternate encoding).
    Right curly bracket (}) key.
    Deprecated.
    Use RIGHT_PARENTHESIS instead.
    Right parenthesis ()) key.
    Right square bracket (]) key.
    Lowercase s key.
    Uppercase S key.
    Semicolon (;) key.
    Number 7 key.
    Number 6 key.
    Slash (/) key.
    Space key.
    Star (*) key.
    Lowercase t key.
    Uppercase T key.
    Number 3 key.
    Tilde (~) key.
    Number 2 key.
    Lowercase u key.
    Uppercase U key.
    Underscore (_) key.
    Unit separator key (Control + _).
    Up arrow key.
    Up arrow key (alternate encoding).
    Lowercase v key.
    Uppercase V key.
    Vertical bar (|) key.
    Lowercase w key.
    Uppercase W key.
    Windows escape sequence identifier.
    Windows escape sequence identifier (alternate).
    Lowercase x key.
    Uppercase X key.
    Lowercase y key.
    Uppercase Y key.
    Lowercase z key.
    Uppercase Z key.
    Number 0 key.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the key values as an IntBuffer.
    boolean
    containKey(int[] input)
    Checks if this key's values are contained within the input array.
    boolean
    equalTo(int[] otherValues)
    Checks if this key's values are equal to the given array.
    boolean
    Checks if this key's values are equal to the given KeyAction.
    static Key
    findStartKey(int[] input)
    Finds the Key that matches the start of the input array.
    static Key
    findStartKey(int[] input, int position)
    Finds the Key that matches the input array starting at the given position.
    char
    Returns the key value as a character.
    int
    getCodePointAt(int index)
    Get the code point at the specified index.
    int
    Returns the first key value.
    static Key
    getKey(int[] otherValues)
    Finds the Key enum constant that matches the given values.
    int[]
    Returns the key values as an int array.
    Returns the key values converted to a String.
    boolean
    inputStartsWithKey(int[] input)
    Checks if the input array starts with this key's values.
    boolean
    inputStartsWithKey(int[] input, int position)
    Checks if the input array starts with this key's values at the given position.
    boolean
    Checks if this key represents an alphabetic character (a-z or A-Z).
    boolean
    Checks if this key represents a numeric digit (0-9).
    boolean
    Checks if this key represents a printable character.
    static boolean
    isPrintable(int value)
    Checks if the given code point value represents a printable character.
    static boolean
    isPrintable(int[] keyValues)
    Checks if the given key values represent a single printable character.
    static boolean
    Checks if the given IntBuffer key values represent a single printable character.
    int
    Get the number of code points in this key action.
    static boolean
    startsWithEscape(int[] input)
    Checks if the input starts with an escape sequence.
    static Key
    Returns the enum constant of this type with the specified name.
    static Key[]
    Returns an array containing the constants of this enum type, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.aesh.terminal.KeyAction

    bufferEquals, name
  • Enum Constant Details

    • CTRL_AT

      public static final Key CTRL_AT
      Control + @ key.
    • CTRL_A

      public static final Key CTRL_A
      Control + A key.
    • CTRL_B

      public static final Key CTRL_B
      Control + B key.
    • CTRL_C

      public static final Key CTRL_C
      Control + C key.
    • CTRL_D

      public static final Key CTRL_D
      Control + D key.
    • CTRL_E

      public static final Key CTRL_E
      Control + E key.
    • CTRL_F

      public static final Key CTRL_F
      Control + F key.
    • CTRL_G

      public static final Key CTRL_G
      Control + G key.
    • CTRL_H

      public static final Key CTRL_H
      Control + H key.
    • CTRL_I

      public static final Key CTRL_I
      Control + I key.
    • CTRL_J

      public static final Key CTRL_J
      Control + J key.
    • CTRL_K

      public static final Key CTRL_K
      Control + K key.
    • CTRL_L

      public static final Key CTRL_L
      Control + L key.
    • CTRL_M

      public static final Key CTRL_M
      Control + M key.
    • CTRL_N

      public static final Key CTRL_N
      Control + N key.
    • CTRL_O

      public static final Key CTRL_O
      Control + O key.
    • CTRL_P

      public static final Key CTRL_P
      Control + P key.
    • CTRL_Q

      public static final Key CTRL_Q
      Control + Q key.
    • CTRL_R

      public static final Key CTRL_R
      Control + R key.
    • CTRL_S

      public static final Key CTRL_S
      Control + S key.
    • CTRL_T

      public static final Key CTRL_T
      Control + T key.
    • CTRL_U

      public static final Key CTRL_U
      Control + U key.
    • CTRL_V

      public static final Key CTRL_V
      Control + V key.
    • CTRL_W

      public static final Key CTRL_W
      Control + W key.
    • CTRL_X

      public static final Key CTRL_X
      Control + X key.
    • CTRL_Y

      public static final Key CTRL_Y
      Control + Y key.
    • CTRL_Z

      public static final Key CTRL_Z
      Control + Z key.
    • ESC

      public static final Key ESC
      Escape key (also Control + [).
    • FILE_SEPARATOR

      public static final Key FILE_SEPARATOR
      File separator key (Control + \).
    • GROUP_SEPARATOR

      public static final Key GROUP_SEPARATOR
      Group separator key (Control + ]).
    • RECORD_SEPARATOR

      public static final Key RECORD_SEPARATOR
      Record separator key (Control + ^).
    • UNIT_SEPARATOR

      public static final Key UNIT_SEPARATOR
      Unit separator key (Control + _).
    • SPACE

      public static final Key SPACE
      Space key.
    • EXCLAMATION

      public static final Key EXCLAMATION
      Exclamation mark (!) key.
    • QUOTE

      public static final Key QUOTE
      Quote (") key.
    • HASH

      public static final Key HASH
      Hash (#) key.
    • DOLLAR

      public static final Key DOLLAR
      Dollar ($) key.
    • PERCENT

      public static final Key PERCENT
      Percent (%) key.
    • AMPERSAND

      public static final Key AMPERSAND
      Ampersand (&) key.
    • APOSTROPHE

      public static final Key APOSTROPHE
      Apostrophe (') key.
    • LEFT_PARENTHESIS

      public static final Key LEFT_PARENTHESIS
      Left parenthesis (() key.
    • LEFT_PARANTHESIS

      @Deprecated public static final Key LEFT_PARANTHESIS
      Deprecated.
      Use LEFT_PARENTHESIS instead. Misspelled name kept for backward compatibility.
    • RIGHT_PARENTHESIS

      public static final Key RIGHT_PARENTHESIS
      Right parenthesis ()) key.
    • RIGHT_PARANTHESIS

      @Deprecated public static final Key RIGHT_PARANTHESIS
      Deprecated.
      Use RIGHT_PARENTHESIS instead. Misspelled name kept for backward compatibility.
    • STAR

      public static final Key STAR
      Star (*) key.
    • PLUS

      public static final Key PLUS
      Plus (+) key.
    • COMMA

      public static final Key COMMA
      Comma (,) key.
    • MINUS

      public static final Key MINUS
      Minus (-) key.
    • PERIOD

      public static final Key PERIOD
      Period (.) key.
    • SLASH

      public static final Key SLASH
      Slash (/) key.
    • ZERO

      public static final Key ZERO
      Number 0 key.
    • ONE

      public static final Key ONE
      Number 1 key.
    • TWO

      public static final Key TWO
      Number 2 key.
    • THREE

      public static final Key THREE
      Number 3 key.
    • FOUR

      public static final Key FOUR
      Number 4 key.
    • FIVE

      public static final Key FIVE
      Number 5 key.
    • SIX

      public static final Key SIX
      Number 6 key.
    • SEVEN

      public static final Key SEVEN
      Number 7 key.
    • EIGHT

      public static final Key EIGHT
      Number 8 key.
    • NINE

      public static final Key NINE
      Number 9 key.
    • COLON

      public static final Key COLON
      Colon (:) key.
    • SEMI_COLON

      public static final Key SEMI_COLON
      Semicolon (;) key.
    • LESS_THAN

      public static final Key LESS_THAN
      Less than (<) key.
    • EQUALS

      public static final Key EQUALS
      Equals (=) key.
    • GREATER_THAN

      public static final Key GREATER_THAN
      Greater than (>) key.
    • QUESTION_MARK

      public static final Key QUESTION_MARK
      Question mark (?) key.
    • AT

      public static final Key AT
      At (@) key.
    • A

      public static final Key A
      Uppercase A key.
    • B

      public static final Key B
      Uppercase B key.
    • C

      public static final Key C
      Uppercase C key.
    • D

      public static final Key D
      Uppercase D key.
    • E

      public static final Key E
      Uppercase E key.
    • F

      public static final Key F
      Uppercase F key.
    • G

      public static final Key G
      Uppercase G key.
    • H

      public static final Key H
      Uppercase H key.
    • I

      public static final Key I
      Uppercase I key.
    • J

      public static final Key J
      Uppercase J key.
    • K

      public static final Key K
      Uppercase K key.
    • L

      public static final Key L
      Uppercase L key.
    • M

      public static final Key M
      Uppercase M key.
    • N

      public static final Key N
      Uppercase N key.
    • O

      public static final Key O
      Uppercase O key.
    • P

      public static final Key P
      Uppercase P key.
    • Q

      public static final Key Q
      Uppercase Q key.
    • R

      public static final Key R
      Uppercase R key.
    • S

      public static final Key S
      Uppercase S key.
    • T

      public static final Key T
      Uppercase T key.
    • U

      public static final Key U
      Uppercase U key.
    • V

      public static final Key V
      Uppercase V key.
    • W

      public static final Key W
      Uppercase W key.
    • X

      public static final Key X
      Uppercase X key.
    • Y

      public static final Key Y
      Uppercase Y key.
    • Z

      public static final Key Z
      Uppercase Z key.
    • LEFT_SQUARE_BRACKET

      public static final Key LEFT_SQUARE_BRACKET
      Left square bracket ([) key.
    • BACKSLASH

      public static final Key BACKSLASH
      Backslash (\) key.
    • RIGHT_SQUARE_BRACKET

      public static final Key RIGHT_SQUARE_BRACKET
      Right square bracket (]) key.
    • HAT

      public static final Key HAT
      Hat (^) key.
    • UNDERSCORE

      public static final Key UNDERSCORE
      Underscore (_) key.
    • GRAVE

      public static final Key GRAVE
      Grave accent (`) key.
    • a

      public static final Key a
      Lowercase a key.
    • b

      public static final Key b
      Lowercase b key.
    • c

      public static final Key c
      Lowercase c key.
    • d

      public static final Key d
      Lowercase d key.
    • e

      public static final Key e
      Lowercase e key.
    • f

      public static final Key f
      Lowercase f key.
    • g

      public static final Key g
      Lowercase g key.
    • h

      public static final Key h
      Lowercase h key.
    • i

      public static final Key i
      Lowercase i key.
    • j

      public static final Key j
      Lowercase j key.
    • k

      public static final Key k
      Lowercase k key.
    • l

      public static final Key l
      Lowercase l key.
    • m

      public static final Key m
      Lowercase m key.
    • n

      public static final Key n
      Lowercase n key.
    • o

      public static final Key o
      Lowercase o key.
    • p

      public static final Key p
      Lowercase p key.
    • q

      public static final Key q
      Lowercase q key.
    • r

      public static final Key r
      Lowercase r key.
    • s

      public static final Key s
      Lowercase s key.
    • t

      public static final Key t
      Lowercase t key.
    • u

      public static final Key u
      Lowercase u key.
    • v

      public static final Key v
      Lowercase v key.
    • w

      public static final Key w
      Lowercase w key.
    • x

      public static final Key x
      Lowercase x key.
    • y

      public static final Key y
      Lowercase y key.
    • z

      public static final Key z
      Lowercase z key.
    • LEFT_CURLY_BRACKET

      public static final Key LEFT_CURLY_BRACKET
      Left curly bracket ({) key.
    • VERTICAL_BAR

      public static final Key VERTICAL_BAR
      Vertical bar (|) key.
    • RIGHT_CURLY_BRACKET

      public static final Key RIGHT_CURLY_BRACKET
      Right curly bracket (}) key.
    • TILDE

      public static final Key TILDE
      Tilde (~) key.
    • BACKSPACE

      public static final Key BACKSPACE
      Backspace key.
    • WINDOWS_ESC

      public static final Key WINDOWS_ESC
      Windows escape sequence identifier.
    • WINDOWS_ESC_2

      public static final Key WINDOWS_ESC_2
      Windows escape sequence identifier (alternate).
    • UP

      public static final Key UP
      Up arrow key.
    • DOWN

      public static final Key DOWN
      Down arrow key.
    • LEFT

      public static final Key LEFT
      Left arrow key.
    • UP_2

      public static final Key UP_2
      Up arrow key (alternate encoding).
    • DOWN_2

      public static final Key DOWN_2
      Down arrow key (alternate encoding).
    • RIGHT_2

      public static final Key RIGHT_2
      Right arrow key (alternate encoding).
    • LEFT_2

      public static final Key LEFT_2
      Left arrow key (alternate encoding).
    • META_a

      public static final Key META_a
      Meta (Alt) + a combination.
    • META_b

      public static final Key META_b
      Meta (Alt) + b combination.
    • META_c

      public static final Key META_c
      Meta (Alt) + c combination.
    • META_d

      public static final Key META_d
      Meta (Alt) + d combination.
    • META_e

      public static final Key META_e
      Meta (Alt) + e combination.
    • META_f

      public static final Key META_f
      Meta (Alt) + f combination.
    • META_l

      public static final Key META_l
      Meta (Alt) + l combination.
    • META_t

      public static final Key META_t
      Meta (Alt) + t combination.
    • META_u

      public static final Key META_u
      Meta (Alt) + u combination.
    • META_BACKSPACE

      public static final Key META_BACKSPACE
      Meta (Alt) + Backspace combination.
    • DELETE

      public static final Key DELETE
      Delete key.
    • INSERT

      public static final Key INSERT
      Insert key.
    • PGUP

      public static final Key PGUP
      Page Up key.
    • PGUP_2

      public static final Key PGUP_2
      Page Up key (alternate encoding for Solaris).
    • PGDOWN

      public static final Key PGDOWN
      Page Down key.
    • PGDOWN_2

      public static final Key PGDOWN_2
      Page Down key (alternate encoding for Solaris).
    • HOME

      public static final Key HOME
      Home key.
    • HOME_2

      public static final Key HOME_2
      Home key (alternate encoding).
    • HOME_3

      public static final Key HOME_3
      Home key (alternate encoding).
    • END

      public static final Key END
      End key.
    • END_2

      public static final Key END_2
      End key (alternate encoding).
    • END_3

      public static final Key END_3
      End key (alternate encoding).
    • META_CTRL_J

      public static final Key META_CTRL_J
      Meta (Alt) + Control + J combination.
    • META_CTRL_D

      public static final Key META_CTRL_D
      Meta (Alt) + Control + D combination.
    • CTRL_X_CTRL_U

      public static final Key CTRL_X_CTRL_U
      Control + X followed by Control + U combination.
    • CTRL_LEFT

      public static final Key CTRL_LEFT
      Control + Left arrow key.
    • CTRL_RIGHT

      public static final Key CTRL_RIGHT
      Control + Right arrow key.
    • CTRL_UP

      public static final Key CTRL_UP
      Control + Up arrow key.
    • CTRL_DOWN

      public static final Key CTRL_DOWN
      Control + Down arrow key.
    • META_RIGHT

      public static final Key META_RIGHT
      Meta (Alt) + Right arrow key.
    • ENTER

      public static final Key ENTER
      Enter key.
    • ENTER_2

      public static final Key ENTER_2
      Enter key (alternate encoding for Windows CR+LF).
  • Method Details

    • values

      public static Key[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static Key valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • isCharacter

      public boolean isCharacter()
      Checks if this key represents an alphabetic character (a-z or A-Z).
      Returns:
      true if this key is an alphabetic character
    • isNumber

      public boolean isNumber()
      Checks if this key represents a numeric digit (0-9).
      Returns:
      true if this key is a numeric digit
    • isPrintable

      public boolean isPrintable()
      Checks if this key represents a printable character.
      Returns:
      true if this key is a printable character
    • isPrintable

      public static boolean isPrintable(int value)
      Checks if the given code point value represents a printable character.
      Parameters:
      value - the code point value to check
      Returns:
      true if the value represents a printable character
    • isPrintable

      public static boolean isPrintable(int[] keyValues)
      Checks if the given key values represent a single printable character.
      Parameters:
      keyValues - the array of key values to check
      Returns:
      true if the values represent a single printable character
    • isPrintable

      public static boolean isPrintable(IntBuffer keyValues)
      Checks if the given IntBuffer key values represent a single printable character.
      Parameters:
      keyValues - the IntBuffer of key values to check
      Returns:
      true if the values represent a single printable character
    • getAsChar

      public char getAsChar()
      Returns the key value as a character.
      Returns:
      the first key value as a char
    • getKeyValues

      public int[] getKeyValues()
      Returns the key values as an int array.
      Returns:
      the array of key code points
    • getKeyValuesAsString

      public String getKeyValuesAsString()
      Returns the key values converted to a String.
      Returns:
      the key values as a String
    • getFirstValue

      public int getFirstValue()
      Returns the first key value.
      Returns:
      the first code point value of this key
    • startsWithEscape

      public static boolean startsWithEscape(int[] input)
      Checks if the input starts with an escape sequence.
      Parameters:
      input - the input array to check
      Returns:
      true if the input starts with an escape character
    • getKey

      public static Key getKey(int[] otherValues)
      Finds the Key enum constant that matches the given values.
      Parameters:
      otherValues - the key values to match
      Returns:
      the matching Key, or null if no match is found
    • findStartKey

      public static Key findStartKey(int[] input)
      Finds the Key that matches the start of the input array.
      Parameters:
      input - the input array to search
      Returns:
      the matching Key, or null if no match is found
    • findStartKey

      public static Key findStartKey(int[] input, int position)
      Finds the Key that matches the input array starting at the given position.
      Parameters:
      input - the input array to search
      position - the starting position in the input array
      Returns:
      the matching Key, or null if no match is found
    • inputStartsWithKey

      public boolean inputStartsWithKey(int[] input)
      Checks if the input array starts with this key's values.
      Parameters:
      input - the input array to check
      Returns:
      true if the input starts with this key's values
    • inputStartsWithKey

      public boolean inputStartsWithKey(int[] input, int position)
      Checks if the input array starts with this key's values at the given position.
      Parameters:
      input - the input array to check
      position - the starting position in the input array
      Returns:
      true if the input starts with this key's values at the given position
    • containKey

      public boolean containKey(int[] input)
      Checks if this key's values are contained within the input array.
      Parameters:
      input - the input array to search
      Returns:
      true if this key's values are found within the input
    • equalTo

      public boolean equalTo(int[] otherValues)
      Checks if this key's values are equal to the given array.
      Parameters:
      otherValues - the values to compare
      Returns:
      true if the values are equal
    • equalTo

      public boolean equalTo(KeyAction key)
      Checks if this key's values are equal to the given KeyAction.
      Parameters:
      key - the KeyAction to compare
      Returns:
      true if the values are equal
    • getCodePointAt

      public int getCodePointAt(int index)
      Get the code point at the specified index.
      Specified by:
      getCodePointAt in interface KeyAction
      Parameters:
      index - the index of the code point
      Returns:
      the code point at the given index
    • length

      public int length()
      Get the number of code points in this key action.
      Specified by:
      length in interface KeyAction
      Returns:
      the length
    • buffer

      public IntBuffer buffer()
      Get the key values as an IntBuffer.
      Specified by:
      buffer in interface KeyAction
      Returns:
      the key values as an IntBuffer