Package com.helger.base.system
Enum Class ENewLineMode
- All Implemented Interfaces:
Serializable,Comparable<ENewLineMode>,Constable
Determines the different newline modes for th different operating systems.
- Author:
- Philip Helger
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ENewLineModeThe default newline mode as indicated by the system properties -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable ENewLineModegetFromTextOrDefault(@Nullable String sText, @Nullable ENewLineMode eDefault) Get theENewLineModematching the provided text representation.static @Nullable ENewLineModegetFromTextOrNull(@Nullable String sText) Get theENewLineModematching the provided text representation.@NonNull @Nonempty StringgetText()booleanisMac()booleanisUnix()booleanstatic ENewLineModeReturns the enum constant of this class with the specified name.static ENewLineMode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
UNIX
Unix style - just \n (0x0A) -
MAC
Mac style - just \r (0x0D) -
WINDOWS
Windows style - \r\n (0x0D 0x0A)
-
-
Field Details
-
DEFAULT
The default newline mode as indicated by the system properties
-
-
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
-
getText
- Returns:
- The textual representation of the new line in this mode. Neither
nullnor empty.
-
isUnix
public boolean isUnix()- Returns:
trueif this a Linux/Unix newline mode
-
isMac
public boolean isMac()- Returns:
trueif this a Mac newline mode
-
isWindows
public boolean isWindows()- Returns:
trueif this a Windows newline mode
-
getFromTextOrDefault
public static @Nullable ENewLineMode getFromTextOrDefault(@Nullable String sText, @Nullable ENewLineMode eDefault) Get theENewLineModematching the provided text representation.- Parameters:
sText- The text to search. May benull.eDefault- The default value to return if no match is found. May benull.- Returns:
- The matching enum value or the provided default.
-
getFromTextOrNull
Get theENewLineModematching the provided text representation.- Parameters:
sText- The text to search. May benull.- Returns:
- The matching enum value or
null.
-