| 424 | } |
| 425 | |
| 426 | public void getBytes(int srcOffset, int srcLength, |
| 427 | byte[] dst, int dstOffset) |
| 428 | { |
| 429 | if (srcOffset < 0) |
| 430 | throw new StringIndexOutOfBoundsException(srcOffset); |
| 431 | else if (srcOffset + srcLength > length) |
| 432 | throw new StringIndexOutOfBoundsException(srcOffset + srcLength); |
| 433 | else if (srcLength < 0) |
| 434 | throw new StringIndexOutOfBoundsException(srcLength); |
| 435 | |
| 436 | if (data instanceof char[]) { |
| 437 | char[] src = (char[]) data; |
| 438 | for (int i = 0; i < srcLength; ++i) { |
| 439 | dst[i + dstOffset] = (byte) src[i + offset + srcOffset]; |
| 440 | } |
| 441 | } else { |
| 442 | byte[] src = (byte[]) data; |
| 443 | System.arraycopy(src, offset + srcOffset, dst, dstOffset, srcLength); |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | public byte[] getBytes() { |
| 448 | try { |