1 /*
2 * SPDX-License-Identifier: Apache-2.0
3 * See LICENSE file for details.
4 *
5 * Copyright 2025-2026 Hazendaz
6 * Copyright 2011-2025 Acegi Technology Pty Limited.
7 */
8 package au.com.acegi.xmlformat;
9
10 /**
11 * Valid line endings for use by {@link XmlFormatPlugin#lineEnding}.
12 */
13 public enum LineEnding {
14
15 /**
16 * Use the system default line ending.
17 */
18 SYSTEM(),
19
20 /**
21 * Use the newline character. Typical on Unix and Unix-like systems.
22 */
23 LF("\n"),
24
25 /**
26 * Use the carriage return and new line characters. Typical on Windows.
27 */
28 CRLF("\r\n"),
29
30 /**
31 * Use the carriage return character.
32 */
33 CR("\r");
34
35 private final String chars;
36
37 LineEnding() {
38 this.chars = System.lineSeparator();
39 }
40
41 LineEnding(final String value) {
42 this.chars = value;
43 }
44
45 /**
46 * Gets the chars.
47 *
48 * @return the chars
49 */
50 public String getChars() {
51 return this.chars;
52 }
53
54 }