244 |
public synchronized void getChars(int srcOffset, int srcEnd, |
public synchronized void getChars(int srcOffset, int srcEnd, |
245 |
char[] dst, int dstOffset) |
char[] dst, int dstOffset) |
246 |
{ |
{ |
247 |
int todo = srcEnd - srcOffset; |
if (srcOffset < 0 || srcEnd > count || srcEnd < srcOffset) |
|
if (srcOffset < 0 || srcEnd > count || todo < 0) |
|
248 |
throw new StringIndexOutOfBoundsException(); |
throw new StringIndexOutOfBoundsException(); |
249 |
System.arraycopy(value, srcOffset, dst, dstOffset, todo); |
System.arraycopy(value, srcOffset, dst, dstOffset, srcEnd - srcOffset); |
250 |
} |
} |
251 |
|
|
252 |
/** |
/** |
354 |
*/ |
*/ |
355 |
public synchronized StringBuffer append(char[] data, int offset, int count) |
public synchronized StringBuffer append(char[] data, int offset, int count) |
356 |
{ |
{ |
357 |
|
if (offset < 0 || count < 0 || offset > data.length - count) |
358 |
|
throw new StringIndexOutOfBoundsException(); |
359 |
ensureCapacity_unsynchronized(this.count + count); |
ensureCapacity_unsynchronized(this.count + count); |
360 |
System.arraycopy(data, offset, value, this.count, count); |
System.arraycopy(data, offset, value, this.count, count); |
361 |
this.count += count; |
this.count += count; |
564 |
public synchronized String substring(int beginIndex, int endIndex) |
public synchronized String substring(int beginIndex, int endIndex) |
565 |
{ |
{ |
566 |
int len = endIndex - beginIndex; |
int len = endIndex - beginIndex; |
567 |
if (beginIndex < 0 || endIndex > count || len < 0) |
if (beginIndex < 0 || endIndex > count || endIndex < beginIndex) |
568 |
throw new StringIndexOutOfBoundsException(); |
throw new StringIndexOutOfBoundsException(); |
569 |
if (len == 0) |
if (len == 0) |
570 |
return ""; |
return ""; |
593 |
char[] str, int str_offset, int len) |
char[] str, int str_offset, int len) |
594 |
{ |
{ |
595 |
if (offset < 0 || offset > count || len < 0 |
if (offset < 0 || offset > count || len < 0 |
596 |
|| str_offset < 0 || str_offset + len > str.length) |
|| str_offset < 0 || str_offset > str.length - len) |
597 |
throw new StringIndexOutOfBoundsException(); |
throw new StringIndexOutOfBoundsException(); |
598 |
ensureCapacity_unsynchronized(count + len); |
ensureCapacity_unsynchronized(count + len); |
599 |
System.arraycopy(value, offset, value, offset + len, count - offset); |
System.arraycopy(value, offset, value, offset + len, count - offset); |