1509 } 1510 } 1511 } 1512 } 1513 1514 /** 1515 * Returns a string representing the data in this sequence. 1516 * A new {@code String} object is allocated and initialized to 1517 * contain the character sequence currently represented by this 1518 * object. This {@code String} is then returned. Subsequent 1519 * changes to this sequence do not affect the contents of the 1520 * {@code String}. 1521 * 1522 * @return a string representation of this sequence of characters. 1523 */ 1524 @Override 1525 public abstract String toString(); 1526 1527 /** 1528 * {@inheritDoc} 1529 * @since 1.9 1530 */ 1531 @Override 1532 public IntStream chars() { 1533 byte[] val = this.value; int count = this.count; byte coder = this.coder; 1534 checkOffset(count, val.length >> coder); 1535 // Reuse String-based spliterator. This requires a supplier to 1536 // capture the value and count when the terminal operation is executed 1537 return StreamSupport.intStream( 1538 () -> coder == LATIN1 ? new StringLatin1.CharsSpliterator(val, 0, count, 0) 1539 : new StringUTF16.CharsSpliterator(val, 0, count, 0), 1540 Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED, 1541 false); 1542 } 1543 1544 /** 1545 * {@inheritDoc} 1546 * @since 1.9 1547 */ 1548 @Override 1549 public IntStream codePoints() { 1550 byte[] val = this.value; int count = this.count; byte coder = this.coder; 1551 checkOffset(count, val.length >> coder); 1552 // Reuse String-based spliterator. This requires a supplier to 1553 // capture the value and count when the terminal operation is executed 1554 return StreamSupport.intStream( 1555 () -> coder == LATIN1 ? new StringLatin1.CharsSpliterator(val, 0, count, 0) 1556 : new StringUTF16.CodePointsSpliterator(val, 0, count, 0), 1557 Spliterator.ORDERED, 1558 false); 1559 } 1560 1561 /** 1562 * Needed by {@code String} for the contentEquals method. 1563 */ 1564 final byte[] getValue() { 1565 return value; 1566 } | 1509 } 1510 } 1511 } 1512 } 1513 1514 /** 1515 * Returns a string representing the data in this sequence. 1516 * A new {@code String} object is allocated and initialized to 1517 * contain the character sequence currently represented by this 1518 * object. This {@code String} is then returned. Subsequent 1519 * changes to this sequence do not affect the contents of the 1520 * {@code String}. 1521 * 1522 * @return a string representation of this sequence of characters. 1523 */ 1524 @Override 1525 public abstract String toString(); 1526 1527 /** 1528 * {@inheritDoc} 1529 * @since 9 1530 */ 1531 @Override 1532 public IntStream chars() { 1533 byte[] val = this.value; int count = this.count; byte coder = this.coder; 1534 checkOffset(count, val.length >> coder); 1535 // Reuse String-based spliterator. This requires a supplier to 1536 // capture the value and count when the terminal operation is executed 1537 return StreamSupport.intStream( 1538 () -> coder == LATIN1 ? new StringLatin1.CharsSpliterator(val, 0, count, 0) 1539 : new StringUTF16.CharsSpliterator(val, 0, count, 0), 1540 Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED, 1541 false); 1542 } 1543 1544 /** 1545 * {@inheritDoc} 1546 * @since 9 1547 */ 1548 @Override 1549 public IntStream codePoints() { 1550 byte[] val = this.value; int count = this.count; byte coder = this.coder; 1551 checkOffset(count, val.length >> coder); 1552 // Reuse String-based spliterator. This requires a supplier to 1553 // capture the value and count when the terminal operation is executed 1554 return StreamSupport.intStream( 1555 () -> coder == LATIN1 ? new StringLatin1.CharsSpliterator(val, 0, count, 0) 1556 : new StringUTF16.CodePointsSpliterator(val, 0, count, 0), 1557 Spliterator.ORDERED, 1558 false); 1559 } 1560 1561 /** 1562 * Needed by {@code String} for the contentEquals method. 1563 */ 1564 final byte[] getValue() { 1565 return value; 1566 } |