Package com.helger.commons.system
Enum ENewLineMode
- java.lang.Object
-
- java.lang.Enum<ENewLineMode>
-
- com.helger.commons.system.ENewLineMode
-
- All Implemented Interfaces:
Serializable,Comparable<ENewLineMode>
public enum ENewLineMode extends Enum<ENewLineMode>
Determines the different newline modes for th different operating systems.- Author:
- Philip Helger
-
-
Field Summary
Fields Modifier and Type Field Description static ENewLineModeDEFAULTThe default newline mode as indicated by the system properties
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ENewLineModegetFromTextOrDefault(String sText, ENewLineMode eDefault)static ENewLineModegetFromTextOrNull(String sText)StringgetText()booleanisMac()booleanisUnix()booleanisWindows()static ENewLineModevalueOf(String name)Returns the enum constant of this type with the specified name.static ENewLineMode[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
UNIX
public static final ENewLineMode UNIX
Unix style - just \n (0x0A)
-
MAC
public static final ENewLineMode MAC
Mac style - just \r (0x0D)
-
WINDOWS
public static final ENewLineMode WINDOWS
Windows style - \r\n (0x0D 0x0A)
-
-
Field Detail
-
DEFAULT
public static final ENewLineMode DEFAULT
The default newline mode as indicated by the system properties
-
-
Method Detail
-
values
public static ENewLineMode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ENewLineMode c : ENewLineMode.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ENewLineMode 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 nameNullPointerException- if the argument is null
-
getText
@Nonnull @Nonempty public String 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
@Nullable public static ENewLineMode getFromTextOrDefault(@Nullable String sText, @Nullable ENewLineMode eDefault)
-
getFromTextOrNull
@Nullable public static ENewLineMode getFromTextOrNull(@Nullable String sText)
-
-