Enum Class ENewLineMode

java.lang.Object
java.lang.Enum<ENewLineMode>
com.helger.base.system.ENewLineMode
All Implemented Interfaces:
Serializable, Comparable<ENewLineMode>, Constable

public enum ENewLineMode extends Enum<ENewLineMode>
Determines the different newline modes for th different operating systems.
Author:
Philip Helger
  • Enum Constant Details

    • 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 Details

    • DEFAULT

      public static final ENewLineMode DEFAULT
      The default newline mode as indicated by the system properties
  • Method Details

    • values

      public static ENewLineMode[] 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

      public static ENewLineMode valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • getText

      @Nonempty public @NonNull @Nonempty String getText()
      Returns:
      The textual representation of the new line in this mode. Neither null nor empty.
    • isUnix

      public boolean isUnix()
      Returns:
      true if this a Linux/Unix newline mode
    • isMac

      public boolean isMac()
      Returns:
      true if this a Mac newline mode
    • isWindows

      public boolean isWindows()
      Returns:
      true if this a Windows newline mode
    • getFromTextOrDefault

      public static @Nullable ENewLineMode getFromTextOrDefault(@Nullable String sText, @Nullable ENewLineMode eDefault)
      Get the ENewLineMode matching the provided text representation.
      Parameters:
      sText - The text to search. May be null.
      eDefault - The default value to return if no match is found. May be null.
      Returns:
      The matching enum value or the provided default.
    • getFromTextOrNull

      public static @Nullable ENewLineMode getFromTextOrNull(@Nullable String sText)
      Get the ENewLineMode matching the provided text representation.
      Parameters:
      sText - The text to search. May be null.
      Returns:
      The matching enum value or null.