|
43 | 43 | import static java.lang.String.LATIN1;
|
44 | 44 |
|
45 | 45 | final class StringUTF16 {
|
46 |
| - |
47 | 46 | // Return a new byte array for a UTF16-coded string for len chars
|
48 | 47 | // Throw an exception if out of range
|
49 | 48 | public static byte[] newBytesFor(int len) {
|
@@ -1548,27 +1547,20 @@ public static boolean contentEquals(byte[] value, CharSequence cs, int len) {
|
1548 | 1547 | return true;
|
1549 | 1548 | }
|
1550 | 1549 |
|
1551 |
| - public static int putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4) { |
1552 |
| - int end = i + 4; |
1553 |
| - checkBoundsBeginEnd(i, end, value); |
1554 |
| - putChar(value, i++, c1); |
1555 |
| - putChar(value, i++, c2); |
1556 |
| - putChar(value, i++, c3); |
1557 |
| - putChar(value, i++, c4); |
1558 |
| - assert(i == end); |
1559 |
| - return end; |
1560 |
| - } |
1561 |
| - |
1562 |
| - public static int putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4, char c5) { |
1563 |
| - int end = i + 5; |
1564 |
| - checkBoundsBeginEnd(i, end, value); |
1565 |
| - putChar(value, i++, c1); |
1566 |
| - putChar(value, i++, c2); |
1567 |
| - putChar(value, i++, c3); |
1568 |
| - putChar(value, i++, c4); |
1569 |
| - putChar(value, i++, c5); |
1570 |
| - assert(i == end); |
1571 |
| - return end; |
| 1550 | + static void putCharsAt(byte[] val, int index, int c1, int c2, int c3, int c4) { |
| 1551 | + assert index >= 0 && index + 3 < length(val) : "Trusted caller missed bounds check"; |
| 1552 | + putChar(val, index , c1); |
| 1553 | + putChar(val, index + 1, c2); |
| 1554 | + putChar(val, index + 2, c3); |
| 1555 | + putChar(val, index + 3, c4); |
| 1556 | + } |
| 1557 | + |
| 1558 | + static void putCharsAt(byte[] val, int index, int c1, int c2, int c3, int c4, int c5) { |
| 1559 | + putChar(val, index , c1); |
| 1560 | + putChar(val, index + 1, c2); |
| 1561 | + putChar(val, index + 2, c3); |
| 1562 | + putChar(val, index + 3, c4); |
| 1563 | + putChar(val, index + 4, c5); |
1572 | 1564 | }
|
1573 | 1565 |
|
1574 | 1566 | public static char charAt(byte[] value, int index) {
|
|
0 commit comments