public enum LineSeparator extends Enum<LineSeparator>
Utils.EOL
which is not explicit in representing the system's EOL character.
Enum Constant and Description |
---|
ARBITRARY
The ARBITRARY line ending can be used where we do not care about the line separator,
only that we use the same one consistently
|
CR
The CR
\r line ending is the default line separator for classic MacOS |
CRLF
The CRLF
\r\n line ending is the default line separator for Windows |
LF
The LF
\n line ending is the default line separator for Unix and modern MacOS |
MIXED
The MIXED line ending is used where strings appear to have multiple different line separators e.g.
|
NONE
The NONE line ending is used where there are precisely zero line endings e.g. a simple one-line string
|
SYSTEM
This line ending is set to whatever the host system's line separator is
|
UNKNOWN
The UNKNOWN line ending can be used in the case where the given string has not yet been analysed to determine its
line separator
|
Modifier and Type | Method and Description |
---|---|
String |
asEscapedString() |
String |
asRawString() |
String |
describe() |
static LineSeparator |
detect(String string) |
boolean |
equalsString(LineSeparator lineSeparator) |
static LineSeparator |
getLineEnding(int countCr,
int countLf,
int countCrLf) |
boolean |
isStandardEol() |
static Optional<LineSeparator> |
lookup(String ending) |
static Optional<LineSeparator> |
lookupEscaped(String ending) |
String |
toString() |
static LineSeparator |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static LineSeparator[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final LineSeparator CR
\r
line ending is the default line separator for classic MacOSpublic static final LineSeparator LF
\n
line ending is the default line separator for Unix and modern MacOSpublic static final LineSeparator CRLF
\r\n
line ending is the default line separator for Windowspublic static final LineSeparator SYSTEM
public static final LineSeparator ARBITRARY
public static final LineSeparator MIXED
"line
1\nline 2\rline 3\r\n"
or "line 1\nline 2\rline 3\nline 4\n"
public static final LineSeparator UNKNOWN
public static final LineSeparator NONE
public static LineSeparator[] values()
for (LineSeparator c : LineSeparator.values()) System.out.println(c);
public static LineSeparator valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static LineSeparator detect(String string)
public static LineSeparator getLineEnding(int countCr, int countLf, int countCrLf)
public static Optional<LineSeparator> lookup(String ending)
ending
- A string containing ONLY the line separator needle (e.g. \r
, \n
, or \r\n
)\r
, \n
, or \r\n
),
return that. Otherwise an empty optional.public static Optional<LineSeparator> lookupEscaped(String ending)
public String describe()
public boolean equalsString(LineSeparator lineSeparator)
public boolean isStandardEol()
public String asEscapedString()
public String asRawString()
public String toString()
toString
in class Enum<LineSeparator>
Copyright © 2007–2024. All rights reserved.