/[classpath]/classpath/java/lang/String.java
ViewVC logotype

Diff of /classpath/java/lang/String.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.58 by mkoch, Thu Jul 22 08:43:44 2004 UTC revision 1.58.2.1 by tromey, Wed Sep 8 00:45:41 2004 UTC
# Line 1  Line 1 
1  /* String.java -- immutable character sequences; the object of string literals  /* String.java -- immutable character sequences; the object of string literals
2     Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003     Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
3     Free Software Foundation, Inc.     Free Software Foundation, Inc.
4    
5  This file is part of GNU Classpath.  This file is part of GNU Classpath.
# Line 423  public final class String implements Ser Line 423  public final class String implements Ser
423    {    {
424      synchronized (buffer)      synchronized (buffer)
425        {        {
426            offset = 0;
427            count = buffer.count;
428            // Share unless buffer is 3/4 empty.
429            if ((count << 2) < buffer.value.length)
430              {
431                value = new char[count];
432                System.arraycopy(buffer.value, 0, value, 0, count);
433              }
434            else
435              {
436                buffer.shared = true;
437                value = buffer.value;
438              }
439          }
440      }
441    
442      /**
443       * Creates a new String using the character sequence represented by
444       * the StringBuilder. Subsequent changes to buf do not affect the String.
445       *
446       * @param buffer StringBuilder to copy
447       * @throws NullPointerException if buffer is null
448       */
449      public String(StringBuilder buffer)
450      {
451        synchronized (buffer)
452          {
453          offset = 0;          offset = 0;
454          count = buffer.count;          count = buffer.count;
455          // Share unless buffer is 3/4 empty.          // Share unless buffer is 3/4 empty.

Legend:
Removed from v.1.58  
changed lines
  Added in v.1.58.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26