xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zong...@apache.org
Subject cvs commit: xml-xalan/java/src/org/apache/xml/utils FastStringBuffer.java
Date Sat, 21 Dec 2002 10:25:06 GMT
zongaro     2002/12/21 02:25:06

  Modified:    java/src/org/apache/xml/utils Tag: XSLTC_DTM
                        FastStringBuffer.java
  Log:
  When converting a run of characters in a FastStringBuffer to a java.lang.String,
  check whether all the characters are in the same chunk.  If so, there's no
  need to create a StringBuffer into which to copy them - the subpart of the
  chunk can be converted to String directly more efficiently.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.18.6.2  +12 -2     xml-xalan/java/src/org/apache/xml/utils/FastStringBuffer.java
  
  Index: FastStringBuffer.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/FastStringBuffer.java,v
  retrieving revision 1.18.6.1
  retrieving revision 1.18.6.2
  diff -u -r1.18.6.1 -r1.18.6.2
  --- FastStringBuffer.java	29 Jul 2002 00:01:31 -0000	1.18.6.1
  +++ FastStringBuffer.java	21 Dec 2002 10:25:06 -0000	1.18.6.2
  @@ -900,8 +900,18 @@
      */
     public String getString(int start, int length)
     {
  -    return getString(new StringBuffer(length), start >>> m_chunkBits,
  -                     start & m_chunkMask, length).toString();
  +    int startColumn = start & m_chunkMask;
  +    int startChunk = start >>> m_chunkBits;
  +    if (startColumn + length < m_chunkMask && m_innerFSB == null) {
  +      return getOneChunkString(startChunk, startColumn, length);
  +    }
  +    return getString(new StringBuffer(length), startChunk, startColumn,
  +                     length).toString();
  +  }
  +
  +  protected String getOneChunkString(int startChunk, int startColumn,
  +                                     int length) {
  +    return new String(m_array[startChunk], startColumn, length);
     }
   
     /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message