/** * Appends an object to this string builder. * Appending null will call {@link #appendNull()}. * * @param obj the object to append * @return this, to enable chaining */ public StrBuilder append(Object obj) { if (obj == null) { return appendNull(); } return append(obj.toString()); }
/** * Appends a string buffer to this string builder. * Appending null will call {@link #appendNull()}. * * @param str the string buffer to append * @return this, to enable chaining */ public StrBuilder append(StringBuffer str) { if (str == null) { return appendNull(); } int strLen = str.length(); if (strLen > 0) { int len = length(); ensureCapacity(len + strLen); str.getChars(0, strLen, buffer, len); size += strLen; } return this; }
/** * Appends a string to this string builder. * Appending null will call {@link #appendNull()}. * * @param str the string to append * @return this, to enable chaining */ public StrBuilder append(String str) { if (str == null) { return appendNull(); } int strLen = str.length(); if (strLen > 0) { int len = length(); ensureCapacity(len + strLen); str.getChars(0, strLen, buffer, len); size += strLen; } return this; }
/** * Appends a char array to the string builder. * Appending null will call {@link #appendNull()}. * * @param chars the char array to append * @return this, to enable chaining */ public StrBuilder append(char[] chars) { if (chars == null) { return appendNull(); } int strLen = chars.length; if (strLen > 0) { int len = length(); ensureCapacity(len + strLen); System.arraycopy(chars, 0, buffer, len, strLen); size += strLen; } return this; }
/** * Appends another string builder to this string builder. * Appending null will call {@link #appendNull()}. * * @param str the string builder to append * @return this, to enable chaining */ public StrBuilder append(StrBuilder str) { if (str == null) { return appendNull(); } int strLen = str.length(); if (strLen > 0) { int len = length(); ensureCapacity(len + strLen); System.arraycopy(str.buffer, 0, buffer, len, strLen); size += strLen; } return this; }
/** * Appends part of a string to this string builder. * Appending null will call {@link #appendNull()}. * * @param str the string to append * @param startIndex the start index, inclusive, must be valid * @param length the length to append, must be valid * @return this, to enable chaining */ public StrBuilder append(String str, int startIndex, int length) { if (str == null) { return appendNull(); } if (startIndex < 0 || startIndex > str.length()) { throw new StringIndexOutOfBoundsException("startIndex must be valid"); } if (length < 0 || (startIndex + length) > str.length()) { throw new StringIndexOutOfBoundsException("length must be valid"); } if (length > 0) { int len = length(); ensureCapacity(len + length); str.getChars(startIndex, startIndex + length, buffer, len); size += length; } return this; }
/** * Appends part of a string buffer to this string builder. * Appending null will call {@link #appendNull()}. * * @param str the string to append * @param startIndex the start index, inclusive, must be valid * @param length the length to append, must be valid * @return this, to enable chaining */ public StrBuilder append(StringBuffer str, int startIndex, int length) { if (str == null) { return appendNull(); } if (startIndex < 0 || startIndex > str.length()) { throw new StringIndexOutOfBoundsException("startIndex must be valid"); } if (length < 0 || (startIndex + length) > str.length()) { throw new StringIndexOutOfBoundsException("length must be valid"); } if (length > 0) { int len = length(); ensureCapacity(len + length); str.getChars(startIndex, startIndex + length, buffer, len); size += length; } return this; }
/** * Appends a char array to the string builder. * Appending null will call {@link #appendNull()}. * * @param chars the char array to append * @param startIndex the start index, inclusive, must be valid * @param length the length to append, must be valid * @return this, to enable chaining */ public StrBuilder append(char[] chars, int startIndex, int length) { if (chars == null) { return appendNull(); } if (startIndex < 0 || startIndex > chars.length) { throw new StringIndexOutOfBoundsException("Invalid startIndex: " + length); } if (length < 0 || (startIndex + length) > chars.length) { throw new StringIndexOutOfBoundsException("Invalid length: " + length); } if (length > 0) { int len = length(); ensureCapacity(len + length); System.arraycopy(chars, startIndex, buffer, len, length); size += length; } return this; }
/** * Appends part of a string builder to this string builder. * Appending null will call {@link #appendNull()}. * * @param str the string to append * @param startIndex the start index, inclusive, must be valid * @param length the length to append, must be valid * @return this, to enable chaining */ public StrBuilder append(StrBuilder str, int startIndex, int length) { if (str == null) { return appendNull(); } if (startIndex < 0 || startIndex > str.length()) { throw new StringIndexOutOfBoundsException("startIndex must be valid"); } if (length < 0 || (startIndex + length) > str.length()) { throw new StringIndexOutOfBoundsException("length must be valid"); } if (length > 0) { int len = length(); ensureCapacity(len + length); str.getChars(startIndex, startIndex + length, buffer, len); size += length; } return this; }
/** * Appends an object to this string builder. * Appending null will call {@link #appendNull()}. * * @param obj the object to append * @return this, to enable chaining */ public StrBuilder append(Object obj) { if (obj == null) { return appendNull(); } return append(obj.toString()); }
/** * Appends an object to this string builder. * Appending null will call {@link #appendNull()}. * * @param obj the object to append * @return this, to enable chaining */ public StrBuilder append(Object obj) { if (obj == null) { return appendNull(); } return append(obj.toString()); }
/** * Appends an object to this string builder. * Appending null will call {@link #appendNull()}. * * @param obj the object to append * @return this, to enable chaining */ public StrBuilder append(Object obj) { if (obj == null) { return appendNull(); } return append(obj.toString()); }
/** * Appends an object to this string builder. * Appending null will call {@link #appendNull()}. * * @param obj the object to append * @return this, to enable chaining */ public StrBuilder append(Object obj) { if (obj == null) { return appendNull(); } return append(obj.toString()); }
/** * Appends an object to this string builder. * Appending null will call {@link #appendNull()}. * * @param obj the object to append * @return this, to enable chaining */ public StrBuilder append(Object obj) { if (obj == null) { return appendNull(); } return append(obj.toString()); }
/** * Appends a string buffer to this string builder. * Appending null will call {@link #appendNull()}. * * @param str the string buffer to append * @return this, to enable chaining */ public StrBuilder append(StringBuffer str) { if (str == null) { return appendNull(); } int strLen = str.length(); if (strLen > 0) { int len = length(); ensureCapacity(len + strLen); str.getChars(0, strLen, buffer, len); size += strLen; } return this; }
/** * Appends a string buffer to this string builder. * Appending null will call {@link #appendNull()}. * * @param str the string buffer to append * @return this, to enable chaining */ public StrBuilder append(StringBuffer str) { if (str == null) { return appendNull(); } int strLen = str.length(); if (strLen > 0) { int len = length(); ensureCapacity(len + strLen); str.getChars(0, strLen, buffer, len); size += strLen; } return this; }
/** * Appends a string to this string builder. * Appending null will call {@link #appendNull()}. * * @param str the string to append * @return this, to enable chaining */ public StrBuilder append(String str) { if (str == null) { return appendNull(); } int strLen = str.length(); if (strLen > 0) { int len = length(); ensureCapacity(len + strLen); str.getChars(0, strLen, buffer, len); size += strLen; } return this; }
/** * Appends a char array to the string builder. * Appending null will call {@link #appendNull()}. * * @param chars the char array to append * @return this, to enable chaining */ public StrBuilder append(char[] chars) { if (chars == null) { return appendNull(); } int strLen = chars.length; if (strLen > 0) { int len = length(); ensureCapacity(len + strLen); System.arraycopy(chars, 0, buffer, len, strLen); size += strLen; } return this; }
/** * Appends another string builder to this string builder. * Appending null will call {@link #appendNull()}. * * @param str the string builder to append * @return this, to enable chaining */ public StrBuilder append(StrBuilder str) { if (str == null) { return appendNull(); } int strLen = str.length(); if (strLen > 0) { int len = length(); ensureCapacity(len + strLen); System.arraycopy(str.buffer, 0, buffer, len, strLen); size += strLen; } return this; }
/** * Appends another string builder to this string builder. * Appending null will call {@link #appendNull()}. * * @param str the string builder to append * @return this, to enable chaining */ public StrBuilder append(StrBuilder str) { if (str == null) { return appendNull(); } int strLen = str.length(); if (strLen > 0) { int len = length(); ensureCapacity(len + strLen); System.arraycopy(str.buffer, 0, buffer, len, strLen); size += strLen; } return this; }