Enum ENewLineMode

java.lang.Object
java.lang.Enum<ENewLineMode>
com.helger.commons.system.ENewLineMode
All Implemented Interfaces:
Serializable, Comparable<ENewLineMode>, java.lang.constant.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 type, in the order they are declared.
      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 name
      NullPointerException - if the argument is null
    • getText

      @Nonnull @Nonempty public 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

      @Nullable public static ENewLineMode getFromTextOrDefault(@Nullable String sText, @Nullable ENewLineMode eDefault)
    • getFromTextOrNull

      @Nullable public static ENewLineMode getFromTextOrNull(@Nullable String sText)