public final class LineEndingsUtils
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
private |
LineEndingsUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
convertLineEndings(java.io.File source,
java.io.File dest,
LineEndings lineEndings,
java.lang.Boolean atEndOfFile,
java.lang.String encoding)
Converts the line endings of a file, writing a new file.
|
static LineEndings |
getLineEnding(java.lang.String lineEnding) |
static java.lang.String |
getLineEndingCharacters(java.lang.String lineEnding)
Returns the appopriate line ending characters for the specified style
|
static java.io.InputStream |
lineEndingConverter(java.io.InputStream in,
LineEndings lineEndings)
Converts the line endings of a file, writing a new file.
|
public static void convertLineEndings(@Nonnull java.io.File source, @Nonnull java.io.File dest, LineEndings lineEndings, java.lang.Boolean atEndOfFile, java.lang.String encoding) throws java.io.IOException
source
- The source file, not nulldest
- The destination file, not nulllineEndings
- This is the result of the getLineEndingChars(..) method in this utility class; the actual
line-ending characters, not null.atEndOfFile
- The end-of-file line ending, if true then the resulting file will have a new line at the end
even if the input didn't have one, if false then the resulting file will have no new line at
the end even if the input did have one, null to determine whether to have a new line at the
end of the file based on the input fileencoding
- The encoding to use, null for platform encodingjava.io.IOException
- .public static java.io.InputStream lineEndingConverter(@Nonnull java.io.InputStream in, LineEndings lineEndings) throws java.io.IOException
in
- The source readerlineEndings
- This is the result of the getLineEndingChars(..) method in this utility class; the actual
line-ending characters, not null.java.io.IOException
@Nonnull public static LineEndings getLineEnding(@Nullable java.lang.String lineEnding) throws AssemblyFormattingException
AssemblyFormattingException
@Nullable public static java.lang.String getLineEndingCharacters(@Nullable java.lang.String lineEnding) throws AssemblyFormattingException
lineEnding
- The name of the line ending style,
see org.apache.maven.plugin.assembly.utils.LineEndings#valueOfAssemblyFormattingException