- 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 ConstantDescription -
Method Summary
Modifier and TypeMethodDescriptionchar
Retrieves the escape code character for the accordingEscapeCode
.Retrieves the escape sequenceString
for the accordingEscapeCode
being the escaped escape code.static EscapeCode
toEscapeCode
(char aEscapeCode) Translate the providedEscapeCode
character to the according escape sequence.static EscapeCode
toEscapeCode
(String aEscapeSequence) Translate the provided escape sequence to the accordingEscapeCode
element.static EscapeCode
Returns 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 sequenceString
for the accordingEscapeCode
being 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 providedEscapeCode
character to the according escape sequence.- Parameters:
aEscapeCode
- The escape code character to translate to the accordingEscapeCode
element.- Returns:
- The according
EscapeCode
or null if the provided escape code did not represent an escape code as of theEscapeCode
enumeration.
-
toEscapeCode
Translate the provided escape sequence to the accordingEscapeCode
element.- Parameters:
aEscapeSequence
- The escape sequence to translate to the accordingEscapeCode
element.- Returns:
- The according
EscapeCode
or null if the provided escape code did not represent an escape code as of theEscapeCode
enumeration.
-