src/share/classes/java/lang/StringBuffer.java

Print this page




 540         return lastIndexOf(str, count);
 541     }
 542 
 543     /**
 544      * @throws NullPointerException {@inheritDoc}
 545      * @since      1.4
 546      */
 547     public synchronized int lastIndexOf(String str, int fromIndex) {
 548         return String.lastIndexOf(value, 0, count,
 549                               str.toCharArray(), 0, str.length(), fromIndex);
 550     }
 551 
 552     /**
 553      * @since   JDK1.0.2
 554      */
 555     public synchronized StringBuffer reverse() {
 556         super.reverse();
 557         return this;
 558     }
 559 






























 560     public synchronized String toString() {
 561         return new String(value, 0, count);
 562     }
 563 
 564     /**
 565      * Serializable fields for StringBuffer.
 566      *
 567      * @serialField value  char[]
 568      *              The backing character array of this StringBuffer.
 569      * @serialField count int
 570      *              The number of characters in this StringBuffer.
 571      * @serialField shared  boolean
 572      *              A flag indicating whether the backing array is shared.
 573      *              The value is ignored upon deserialization.
 574      */
 575     private static final java.io.ObjectStreamField[] serialPersistentFields =
 576     {
 577         new java.io.ObjectStreamField("value", char[].class),
 578         new java.io.ObjectStreamField("count", Integer.TYPE),
 579         new java.io.ObjectStreamField("shared", Boolean.TYPE),




 540         return lastIndexOf(str, count);
 541     }
 542 
 543     /**
 544      * @throws NullPointerException {@inheritDoc}
 545      * @since      1.4
 546      */
 547     public synchronized int lastIndexOf(String str, int fromIndex) {
 548         return String.lastIndexOf(value, 0, count,
 549                               str.toCharArray(), 0, str.length(), fromIndex);
 550     }
 551 
 552     /**
 553      * @since   JDK1.0.2
 554      */
 555     public synchronized StringBuffer reverse() {
 556         super.reverse();
 557         return this;
 558     }
 559 
 560     /**
 561      * @throws NullPointerException {@inheritDoc}
 562      * @since 1.7
 563      */
 564     @Override
 565     public synchronized StringBuffer join(String delimiter, Object first, Object... elements) {
 566         super.join(delimiter, first, elements);
 567         return this;
 568     }
 569     
 570     /**
 571      * @throws NullPointerException {@inheritDoc}
 572      * @since 1.7
 573      */
 574     @Override
 575     public synchronized StringBuffer join(String delimiter, Object[] elements) {
 576         super.join(delimiter, elements);
 577         return this;
 578     }
 579     
 580     /**
 581      * @throws NullPointerException {@inheritDoc}
 582      * @since 1.7
 583      */
 584     @Override
 585     public synchronized StringBuffer join(String delimiter, Iterable<?> elements) {
 586         super.join(delimiter, elements);
 587         return this;
 588     }
 589     
 590     public synchronized String toString() {
 591         return new String(value, 0, count);
 592     }
 593 
 594     /**
 595      * Serializable fields for StringBuffer.
 596      *
 597      * @serialField value  char[]
 598      *              The backing character array of this StringBuffer.
 599      * @serialField count int
 600      *              The number of characters in this StringBuffer.
 601      * @serialField shared  boolean
 602      *              A flag indicating whether the backing array is shared.
 603      *              The value is ignored upon deserialization.
 604      */
 605     private static final java.io.ObjectStreamField[] serialPersistentFields =
 606     {
 607         new java.io.ObjectStreamField("value", char[].class),
 608         new java.io.ObjectStreamField("count", Integer.TYPE),
 609         new java.io.ObjectStreamField("shared", Boolean.TYPE),