- All Implemented Interfaces:
Serializable,Comparable<EscapeCode>,Constable
The
EscapeCode enumeration contains all of Java's escape codes
(https://docs.oracle.com/javase/tutorial/java/data/characters.html) and the
escape sequences (being the defused escape codes) as well as methods to
retrieve the escape code from the escape sequence (as of
toEscapeCode(String)) and vice versa (as of
toEscapeCode(char)).-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Method Summary
Modifier and TypeMethodDescriptioncharRetrieves the escape code character for the accordingEscapeCode.Retrieves the escape sequenceStringfor the accordingEscapeCodebeing the escaped escape code.static EscapeCodetoEscapeCode(char aEscapeCode) Translate the providedEscapeCodecharacter to the according escape sequence.static EscapeCodetoEscapeCode(String aEscapeSequence) Translate the provided escape sequence to the accordingEscapeCodeelement.static EscapeCodeReturns the enum constant of this class with the specified name.static EscapeCode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
TAB
-
BACKSPACE
-
NEWLINE
-
CARRIAGE_RETURN
-
FORM_FEED
-
SINGLE_QUOTE
-
DOUBLE_QUOTE
-
BASCKSLASH
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException- if the argument is null
-
getEscapeSequence
Retrieves the escape sequenceStringfor the accordingEscapeCodebeing the escaped escape code.- Returns:
- The according escape sequence.
-
getEscapeCode
public char getEscapeCode()Retrieves the escape code character for the accordingEscapeCode.- Returns:
- The according escape code.
-
toEscapeCode
Translate the providedEscapeCodecharacter to the according escape sequence.- Parameters:
aEscapeCode- The escape code character to translate to the accordingEscapeCodeelement.- Returns:
- The according
EscapeCodeor null if the provided escape code did not represent an escape code as of theEscapeCodeenumeration.
-
toEscapeCode
Translate the provided escape sequence to the accordingEscapeCodeelement.- Parameters:
aEscapeSequence- The escape sequence to translate to the accordingEscapeCodeelement.- Returns:
- The according
EscapeCodeor null if the provided escape code did not represent an escape code as of theEscapeCodeenumeration.
-