Fix TEXT-234 (#1223)

Update StrBuilder.java to reflect changes made to commons-text with regards to newline.
(f934b1a539)
This commit is contained in:
Tobias Kiecker 2024-05-23 15:04:53 +02:00 committed by GitHub
parent 2667c3902b
commit 352f9671b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 11 deletions

View File

@ -272,7 +272,9 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
/** Current size of the buffer. */ /** Current size of the buffer. */
protected int size; // TODO make private? protected int size; // TODO make private?
/** The new line. */ /**
* The new line, {@code null} means use the system default from {@link System#lineSeparator()}.
*/
private String newLine; private String newLine;
/** The null text. */ /** The null text. */
@ -1142,14 +1144,18 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
} }
/** /**
* Appends the new line string to this string builder. * Appends this builder's new line string to this builder.
* <p> * <p>
* The new line string can be altered using {@link #setNewLineText(String)}. * By default, the new line is the system default from {@link System#lineSeparator()}.
* This might be used to force the output to always use UNIX line endings * </p>
* even when on Windows. * <p>
* The new line string can be changed using {@link #setNewLineText(String)}. For example, you can use this to force the output to always use UNIX line
* endings even when on Windows.
* </p> * </p>
* *
* @return this, to enable chaining * @return this
* @see #getNewLineText()
* @see #setNewLineText(String)
*/ */
public StrBuilder appendNewLine() { public StrBuilder appendNewLine() {
if (newLine == null) { if (newLine == null) {
@ -1940,9 +1946,9 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
} }
/** /**
* Gets the text to be appended when a new line is added. * Gets the text to be appended when a {@link #appendNewLine() new line} is added.
* *
* @return the new line text, null means use system default * @return The new line text, {@code null} means use the system default from {@link System#lineSeparator()}.
*/ */
public String getNewLineText() { public String getNewLineText() {
return newLine; return newLine;
@ -2811,10 +2817,10 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
} }
/** /**
* Sets the text to be appended when a new line is added. * Sets the text to be appended when {@link #appendNewLine() new line} is called.
* *
* @param newLine the new line text, null means use system default * @param newLine the new line text, {@code null} means use the system default from {@link System#lineSeparator()}.
* @return this, to enable chaining * @return this.
*/ */
public StrBuilder setNewLineText(final String newLine) { public StrBuilder setNewLineText(final String newLine) {
this.newLine = newLine; this.newLine = newLine;