Class LineEndingConverter


  • public final class LineEndingConverter
    extends Object
    Utility methods for handling line endings in files.
    • Method Detail

      • normalizeToUnix

        public static String normalizeToUnix​(String value)
        Normalizes all line endings that may be Windows or MacOS-style and converts them to Unix-style line endings.
        Parameters:
        value - String containing any line endings.
        Returns:
        String containing only unix line endings.
      • convertTo

        public static String convertTo​(String normalizedValue,
                                       LineEndings lineEndings)
        Converts all unix line endings to the given line ending style.
        Parameters:
        normalizedValue - String with line endings normalized to Unix-style
        lineEndings - Line ending style.
        Returns:
        String with the given line ending style.