public final char[] sub_chars(int offset, int count) { char[] chars = new char[count]; text.getChars(offset, offset + count, chars, 0); return chars; }
public void arraycopy(int srcPos, char[] dest, int destPos, int length) { text.getChars(srcPos, srcPos + length, dest, destPos); }
private static String subString(String src, int offset, int len) { char[] chars = new char[len]; src.getChars(offset, offset + len, chars, 0); return new String(chars); }
/** Constructs an instance that's initialized with the contents of the specified {@code String}. The capacity of the new * builder will be the length of the {@code String} plus 16. * * @param string the {@code String} to copy into the builder. * @throws NullPointerException if {@code str} is {@code null}. */ public StringBuilder (String string) { length = string.length(); chars = new char[length + INITIAL_CAPACITY]; string.getChars(0, length, chars, 0); }
/** Constructs an instance that's initialized with the contents of the specified {@code String}. The capacity of the new * builder will be the length of the {@code String} plus 16. * * @param string the {@code String} to copy into the builder. * @throws NullPointerException if {@code str} is {@code null}. */ public StringBuilder (String string) { length = string.length(); chars = new char[length + INITIAL_CAPACITY]; string.getChars(0, length, chars, 0); }
int reuseBuffMethod(final char[] reusable, final String data) { final int len = data.length(); data.getChars(0, len, reusable, 0); for (int i = 0; i < len; i++) { if (reusable[i] <= ' ') { doThrow(); } } return len; }
private static int _outputSmallestL(char[] b, int off) { int len = SMALLEST_LONG.length(); SMALLEST_LONG.getChars(0, len, b, off); return (off + len); }
@Override public int appendUnquoted(char[] buffer, int offset) { String str = _value; final int length = str.length(); if ((offset + length) > buffer.length) { return -1; } str.getChars(0, length, buffer, offset); return length; }
private static int _outputSmallestI(char[] b, int off) { int len = SMALLEST_INT.length(); SMALLEST_INT.getChars(0, len, b, off); return (off + len); }
private static int _outputSmallestI(char[] b, int off) { int len = SMALLEST_INT.length(); SMALLEST_INT.getChars(0, len, b, off); return (off + len); }
@Override public int read(char[] cs, int off, int len) throws IOException { ensureOpen(); if ((off < 0) || (off > cs.length) || (len < 0) || ((off + len) > cs.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); } if (len == 0) { return 0; } if (mPosition >= mLimit) { return -1; } int n = Math.min(mLimit - mPosition, len); mString.getChars(mPosition, mPosition + n, cs, off); mPosition += n; return n; }
@Override public int read(char[] cs, int off, int len) throws IOException { ensureOpen(); if ((off < 0) || (off > cs.length) || (len < 0) || ((off + len) > cs.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); } if (len == 0) { return 0; } if (mPosition >= mLimit) { return -1; } int n = Math.min(mLimit - mPosition, len); mString.getChars(mPosition, mPosition + n, cs, off); mPosition += n; return n; }
public final CharBuffer get (char[] dest, int off, int len) { int length = dest.length; if ((off < 0) || (len < 0) || (long)off + (long)len > length) { throw new IndexOutOfBoundsException(); } if (len > remaining()) { throw new BufferUnderflowException(); } int newPosition = position + len; sequence.toString().getChars(position, newPosition, dest, off); position = newPosition; return this; }
public final CharBuffer get (char[] dest, int off, int len) { int length = dest.length; if ((off < 0) || (len < 0) || (long)off + (long)len > length) { throw new IndexOutOfBoundsException(); } if (len > remaining()) { throw new BufferUnderflowException(); } int newPosition = position + len; sequence.toString().getChars(position, newPosition, dest, off); position = newPosition; return this; }
final void append0 (String string) { if (string == null) { appendNull(); return; } int adding = string.length(); int newSize = length + adding; if (newSize > chars.length) { enlargeBuffer(newSize); } string.getChars(0, adding, chars, length); length = newSize; }
final void append0 (String string) { if (string == null) { appendNull(); return; } int adding = string.length(); int newSize = length + adding; if (newSize > chars.length) { enlargeBuffer(newSize); } string.getChars(0, adding, chars, length); length = newSize; }
final void insert0 (int index, String string) { if (0 <= index && index <= length) { if (string == null) { string = "null"; } int min = string.length(); if (min != 0) { move(min, index); string.getChars(0, min, chars, index); length += min; } } else { throw new StringIndexOutOfBoundsException(index); } }
@Override public void writeRaw(String text) throws IOException { final int len = text.length(); final char[] buf = _charBuffer; if (len <= buf.length) { text.getChars(0, len, buf, 0); writeRaw(buf, 0, len); } else { writeRaw(text, 0, len); } }
final void insert0 (int index, String string) { if (0 <= index && index <= length) { if (string == null) { string = "null"; } int min = string.length(); if (min != 0) { move(min, index); string.getChars(0, min, chars, index); length += min; } } else { throw new StringIndexOutOfBoundsException(index); } }
@Override public void writeStringUTF(String str) throws IOException { final int strlen = str.length(); writeFInt(strlen); ensureFree(strlen*2); char c[] = getCharBuf(strlen); str.getChars(0,strlen,c,0); buffout.setChar(pos,c,0,strlen); pos += strlen*2; }