package stexfires.util;

import java.util.function.Supplier;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * Enum with three common line separators for text files: {@code LF, CR, CR_LF}.
 *
 * @author Mathias Kalb
 * @since 0.1
 */
@SuppressWarnings("HardcodedLineSeparator")
public enum LineSeparator {

    /**
     * Line feed: {@code '\n'} (0xA)
     */
    LF("\n"),

    /**
     * Carriage return: {@code '\r'} (0xD)
     */
    CR("\r"),

    /**
     * CR and LF: {@code '\r\n'} (0xD 0xA)
     */
    CR_LF("\r\n");

    private final String separator;

    LineSeparator(String separator) {
        this.separator = separator;
    }

    /**
     * Returns the line separator as a {@code String}.
     *
     * @return line separator as a {@code String}
     */
    public final String string() {
        return separator;
    }

    /**
     * Returns the line separator as a {@code Supplier}.
     *
     * @return line separator as a {@code Supplier}
     * @see java.util.function.Supplier
     */
    public final Supplier<String> supplier() {
        return () -> separator;
    }

    /**
     * Returns the line separator as a {@code Stream} with a single element.
     *
     * @return line separator as a {@code Stream} with a single element
     * @see java.util.stream.Stream#of(Object)
     */
    public final Stream<String> stream() {
        return Stream.of(separator);
    }

    /**
     * Returns the line separator as an {@code IntStream} with the chars.
     *
     * @return line separator as an {@code IntStream} with the chars
     * @see java.lang.String#chars()
     */
    public final IntStream chars() {
        return separator.chars();
    }

    /**
     * Returns the line separator as a {@code String}.
     *
     * @return line separator as a {@code String}
     * @see stexfires.util.LineSeparator#string()
     */
    @Override
    public final String toString() {
        return separator;
    }

}

@@ -18,16 +18,41 @@
 .util;%0A%0A
+import java.util.Arrays;%0A
 import j
@@ -79,16 +79,16 @@
 pplier;%0A
-
 import j
@@ -877,32 +877,429 @@
 parator;%0A    %7D%0A%0A
+    /**%0A     * Returns the line separator as a %7B@code String%7D repeated %7B@code count%7D times.%0A     *%0A     * @param count number of times to repeat%0A     * @return line separator as a %7B@code String%7D repeated %7B@code count%7D times%0A     * @throws IllegalArgumentException if the %7B@code count%7D is negative.%0A     */%0A    public final String string(int count) %7B%0A        return separator.repeat(count);%0A    %7D%0A%0A
     /**%0A     * R
@@ -2389,10 +2389,474 @@
 %0A    %7D%0A%0A
+    /**%0A     * Returns the system line separator.%0A     * Default return value is %7B@code LF%7D.%0A     *%0A     * @return system line separator%0A     * @see System#lineSeparator()%0A     */%0A    public static LineSeparator systemLineSeparator() %7B%0A        return Arrays.stream(LineSeparator.values())%0A                     .filter(lineSeparator -%3E lineSeparator.string().equals(System.lineSeparator()))%0A                     .findFirst()%0A                     .orElse(LF);%0A    %7D%0A%0A
 %7D
-%0A

Add methods "systemLineSeparator()" and "string(int count)"