/** * Append a character to the buffer * * @param ch the character to be added */ public void append(char ch) { ensureCapacity(1); array[used++] = ch; }
/** * Append a character to the buffer * * @param ch the character to be added */ public void append(char ch) { ensureCapacity(1); array[used++] = ch; }
/** * Append the contents of a character array to the buffer * * @param srcArray the array whose contents are to be added * @param start the offset of the first character in the array to be copied * @param length the number of characters to be copied */ public void append(char[] srcArray, int start, int length) { ensureCapacity(length); System.arraycopy(srcArray, start, array, used, length); used += length; }
/** * Append the entire contents of a character array to the buffer * * @param srcArray the array whose contents are to be added */ public void append(char[] srcArray) { final int length = srcArray.length; ensureCapacity(length); System.arraycopy(srcArray, 0, array, used, length); used += length; }
/** * Append the contents of a character array to the buffer * * @param srcArray the array whose contents are to be added * @param start the offset of the first character in the array to be copied * @param length the number of characters to be copied */ public void append(char[] srcArray, int start, int length) { ensureCapacity(length); System.arraycopy(srcArray, start, array, used, length); used += length; }
/** * Append the entire contents of a character array to the buffer * * @param srcArray the array whose contents are to be added */ public void append(char[] srcArray) { final int length = srcArray.length; ensureCapacity(length); System.arraycopy(srcArray, 0, array, used, length); used += length; }
/** * Append the contents of a StringBuffer to the buffer * * @param s the StringBuffer to be appended */ public void append(StringBuffer s) { int len = s.length(); ensureCapacity(len); s.getChars(0, len, array, used); used += len; }
/** * Append the contents of a String to the buffer * * @param s the String to be appended */ public void append(String s) { int len = s.length(); ensureCapacity(len); s.getChars(0, len, array, used); used += len; }
/** * Append the contents of a String to the buffer * * @param s the String to be appended */ public void append(String s) { int len = s.length(); ensureCapacity(len); s.getChars(0, len, array, used); used += len; }
/** * Append the contents of a StringBuffer to the buffer * * @param s the StringBuffer to be appended */ public void append(StringBuffer s) { int len = s.length(); ensureCapacity(len); s.getChars(0, len, array, used); used += len; }
/** * Insert a character at a particular offset * * @param index the index of the character to be set * @param ch the new character to insert at that location * @throws IndexOutOfBoundsException if int<0 or int>=length() */ public void insert(int index, char ch) { if (index < 0 || index > used) { throw new IndexOutOfBoundsException("" + index); } ensureCapacity(1); System.arraycopy(array, index, array, index + 1, used - index); used++; array[index] = ch; }
/** * Insert a character at a particular offset * * @param index the index of the character to be set * @param ch the new character to insert at that location * @throws IndexOutOfBoundsException if int<0 or int>=length() */ public void insert(int index, char ch) { if (index < 0 || index > used) { throw new IndexOutOfBoundsException("" + index); } ensureCapacity(1); System.arraycopy(array, index, array, index + 1, used - index); used++; array[index] = ch; }
public static void uncompress(long value, /*@NotNull*/ FastStringBuffer buffer) { for (int s = 56; s >= 0; s -= 8) { byte b = (byte) ((value >>> s) & 0xff); if (b == 0) { break; } char c = WHITE_CHARS[b >>> 6 & 0x3]; int len = b & 0x3f; buffer.ensureCapacity(len); for (int j = 0; j < len; j++) { buffer.append(c); } } }
public static void uncompress(long value, /*@NotNull*/ FastStringBuffer buffer) { for (int s = 56; s >= 0; s -= 8) { byte b = (byte) ((value >>> s) & 0xff); if (b == 0) { break; } char c = WHITE_CHARS[b >>> 6 & 0x3]; int len = b & 0x3f; buffer.ensureCapacity(len); for (int j = 0; j < len; j++) { buffer.append(c); } } }
/** * Insert wide character at a particular offset * * @param index the index of the character to be set * @param ch the character, as a 32-bit Unicode codepoint * @throws IndexOutOfBoundsException if int<0 or int>=length() */ public void insertWideChar(int index, int ch) { if (index < 0 || index > used) { throw new IndexOutOfBoundsException("" + index); } if (ch > 0xffff) { ensureCapacity(2); System.arraycopy(array, index, array, index + 2, used - index); used += 2; array[index] = UTF16CharacterSet.highSurrogate(ch); array[index + 1] = UTF16CharacterSet.lowSurrogate(ch); } else { ensureCapacity(1); System.arraycopy(array, index, array, index + 1, used - index); used++; array[index] = (char) ch; } }
/** * Insert wide character at a particular offset * * @param index the index of the character to be set * @param ch the character, as a 32-bit Unicode codepoint * @throws IndexOutOfBoundsException if int<0 or int>=length() */ public void insertWideChar(int index, int ch) { if (index < 0 || index > used) { throw new IndexOutOfBoundsException("" + index); } if (ch > 0xffff) { ensureCapacity(2); System.arraycopy(array, index, array, index + 2, used - index); used += 2; array[index] = UTF16CharacterSet.highSurrogate(ch); array[index + 1] = UTF16CharacterSet.lowSurrogate(ch); } else { ensureCapacity(1); System.arraycopy(array, index, array, index + 1, used - index); used++; array[index] = (char) ch; } }
/** * Append the contents of a CharSlice to the buffer * * @param s the String to be appended */ public void append(CharSlice s) { int len = s.length(); ensureCapacity(len); s.copyTo(array, used); used += len; }
/** * Append the contents of a FastStringBuffer to the buffer * * @param s the FastStringBuffer to be appended */ public void append(FastStringBuffer s) { int len = s.length(); ensureCapacity(len); s.getChars(0, len, array, used); used += len; }
/** * Append the contents of a CharSlice to the buffer * * @param s the String to be appended */ public void append(CharSlice s) { int len = s.length(); ensureCapacity(len); s.copyTo(array, used); used += len; }
/** * Append the contents of a FastStringBuffer to the buffer * * @param s the FastStringBuffer to be appended */ public void append(FastStringBuffer s) { int len = s.length(); ensureCapacity(len); s.getChars(0, len, array, used); used += len; }