ws-soap-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snic...@apache.org
Subject cvs commit: xml-soap/java/src/org/apache/soap/util/xml DOM2Writer.java DOMUtils.java DOMWriter.java XMISerializer.java
Date Fri, 06 Sep 2002 17:50:27 GMT
snichol     2002/09/06 10:50:27

  Modified:    java/src/org/apache/soap Utils.java
               java/src/org/apache/soap/encoding Hex.java
               java/src/org/apache/soap/transport/http Cookie.java
               java/src/org/apache/soap/util MethodUtils.java
                        StringUtils.java
               java/src/org/apache/soap/util/mime ByteArrayDataSource.java
                        MimeUtils.java
               java/src/org/apache/soap/util/xml DOM2Writer.java
                        DOMUtils.java DOMWriter.java XMISerializer.java
  Log:
  Specify initial sizes for ByteArrayOutputStream and StringBuffer to
  decrease buffer re-allocations.
  
  Revision  Changes    Path
  1.11      +1 -1      xml-soap/java/src/org/apache/soap/Utils.java
  
  Index: Utils.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/Utils.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Utils.java	17 Aug 2001 12:12:39 -0000	1.10
  +++ Utils.java	6 Sep 2002 17:50:26 -0000	1.11
  @@ -79,7 +79,7 @@
         return "";
       }
   
  -    StringBuffer strBuf = new StringBuffer();
  +    StringBuffer strBuf = new StringBuffer(orig.length() * 2);
       char[] chars = orig.toCharArray();
   
       for (int i = 0; i < chars.length; i++)
  
  
  
  1.2       +1 -1      xml-soap/java/src/org/apache/soap/encoding/Hex.java
  
  Index: Hex.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/encoding/Hex.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Hex.java	10 Nov 2001 02:28:10 -0000	1.1
  +++ Hex.java	6 Sep 2002 17:50:26 -0000	1.2
  @@ -131,7 +131,7 @@
        */
       public static byte[] decode(String digits) {
   
  -        ByteArrayOutputStream baos = new ByteArrayOutputStream();
  +        ByteArrayOutputStream baos = new ByteArrayOutputStream((digits.length() + 1)/2);
           for (int i = 0; i < digits.length(); i += 2) {
               char c1 = digits.charAt(i);
               if ((i+1) >= digits.length())
  
  
  
  1.4       +2 -2      xml-soap/java/src/org/apache/soap/transport/http/Cookie.java
  
  Index: Cookie.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/transport/http/Cookie.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Cookie.java	30 Jul 2002 18:46:38 -0000	1.3
  +++ Cookie.java	6 Sep 2002 17:50:26 -0000	1.4
  @@ -238,7 +238,7 @@
        * @return  The Cookie or Cookie2 header value.
        */
       public static String buildCookieValue(URL url, Cookie[] cookies) {
  -        StringBuffer buf = new StringBuffer();
  +        StringBuffer buf = new StringBuffer(512);
   
           /* TODO: order the cookies by path-specificity, cf. 4.3.4 of RFC 2109 */
           for (int i = 0; i < cookies.length; i++) {
  @@ -480,7 +480,7 @@
        * @return  A string appropriate for a Cookie header.
        */
       public String toString() {
  -        StringBuffer buf = new StringBuffer();
  +        StringBuffer buf = new StringBuffer(512);
   
           /*
            * According to RFC 2965, the version should appear before the first cookie
  
  
  
  1.3       +2 -2      xml-soap/java/src/org/apache/soap/util/MethodUtils.java
  
  Index: MethodUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/MethodUtils.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MethodUtils.java	30 May 2000 10:24:25 -0000	1.2
  +++ MethodUtils.java	6 Sep 2002 17:50:26 -0000	1.3
  @@ -219,7 +219,7 @@
     private static String callToString(Class targetClass,String methodName,
                                       Class[] argTypes,boolean isStaticReference)
     {
  -    StringBuffer buf = new StringBuffer();
  +    StringBuffer buf = new StringBuffer(256);
       if(isStaticReference)
         buf.append("static ");
       buf.append(StringUtils.getClassName(targetClass));
  @@ -440,7 +440,7 @@
           return firstElement();
         if(size()>1)
           {
  -          StringBuffer buf=new StringBuffer();
  +          StringBuffer buf=new StringBuffer(256);
             Enumeration e=elements();
             buf.append(e.nextElement());
             while(e.hasMoreElements())
  
  
  
  1.7       +1 -1      xml-soap/java/src/org/apache/soap/util/StringUtils.java
  
  Index: StringUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/StringUtils.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StringUtils.java	22 May 2001 18:23:06 -0000	1.6
  +++ StringUtils.java	6 Sep 2002 17:50:26 -0000	1.7
  @@ -107,7 +107,7 @@
         i++;
       }
   
  -    StringBuffer classNameBuf = new StringBuffer();
  +    StringBuffer classNameBuf = new StringBuffer(256);
   
       switch (classNameChars[i++])
       {
  
  
  
  1.3       +1 -1      xml-soap/java/src/org/apache/soap/util/mime/ByteArrayDataSource.java
  
  Index: ByteArrayDataSource.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/mime/ByteArrayDataSource.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ByteArrayDataSource.java	13 Jan 2001 16:14:10 -0000	1.2
  +++ ByteArrayDataSource.java	6 Sep 2002 17:50:27 -0000	1.3
  @@ -98,7 +98,7 @@
           throws IOException {
           this.type = type;
   
  -        ByteArrayOutputStream os = new ByteArrayOutputStream();
  +        ByteArrayOutputStream os = new ByteArrayOutputStream(4096);
   
           byte buf[] = new byte[4096];
           int len;
  
  
  
  1.5       +2 -2      xml-soap/java/src/org/apache/soap/util/mime/MimeUtils.java
  
  Index: MimeUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/mime/MimeUtils.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MimeUtils.java	14 May 2002 14:52:06 -0000	1.4
  +++ MimeUtils.java	6 Sep 2002 17:50:27 -0000	1.5
  @@ -87,7 +87,7 @@
               host = "localhost";
           }
   
  -        StringBuffer s = new StringBuffer();
  +        StringBuffer s = new StringBuffer(128);
   
           // Unique string is <hashcode>.<currentTime>.apache-soap.<hostname>
           s.append(s.hashCode()).append('.').append(System.currentTimeMillis()).
  @@ -118,7 +118,7 @@
        */
       private static final String hexmap = "0123456789ABCDEF";
       public static String decode(String s) {
  -        StringBuffer ret = new StringBuffer();
  +        StringBuffer ret = new StringBuffer(s.length());
           char c;
           for (int i = 0; i < s.length(); i++) {
               c = s.charAt(i);
  
  
  
  1.6       +1 -1      xml-soap/java/src/org/apache/soap/util/xml/DOM2Writer.java
  
  Index: DOM2Writer.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/xml/DOM2Writer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DOM2Writer.java	7 Aug 2002 21:05:03 -0000	1.5
  +++ DOM2Writer.java	6 Sep 2002 17:50:27 -0000	1.6
  @@ -335,7 +335,7 @@
   
     private static String normalize(String s)
     {
  -    StringBuffer str = new StringBuffer();
  +    StringBuffer str = new StringBuffer(s.length() * 2);
       int len = (s != null) ? s.length() : 0;
   
       for (int i = 0; i < len; i++)
  
  
  
  1.8       +1 -1      xml-soap/java/src/org/apache/soap/util/xml/DOMUtils.java
  
  Index: DOMUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/xml/DOMUtils.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DOMUtils.java	30 Aug 2002 03:22:54 -0000	1.7
  +++ DOMUtils.java	6 Sep 2002 17:50:27 -0000	1.8
  @@ -127,7 +127,7 @@
         return null;
       } 
       Node          tempNode = parentEl.getFirstChild();
  -    StringBuffer  strBuf   = new StringBuffer();
  +    StringBuffer  strBuf   = new StringBuffer(64);
       CharacterData charData;
   
       while (tempNode != null) {
  
  
  
  1.4       +1 -1      xml-soap/java/src/org/apache/soap/util/xml/DOMWriter.java
  
  Index: DOMWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/xml/DOMWriter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DOMWriter.java	1 Sep 2000 03:53:10 -0000	1.3
  +++ DOMWriter.java	6 Sep 2002 17:50:27 -0000	1.4
  @@ -228,7 +228,7 @@
   
     private static String normalize(String s)
     {
  -    StringBuffer str = new StringBuffer();
  +    StringBuffer str = new StringBuffer(s.length() * 2);
       int len = (s != null) ? s.length() : 0;
   
       for (int i = 0; i < len; i++)
  
  
  
  1.10      +1 -1      xml-soap/java/src/org/apache/soap/util/xml/XMISerializer.java
  
  Index: XMISerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/xml/XMISerializer.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XMISerializer.java	25 May 2001 19:26:41 -0000	1.9
  +++ XMISerializer.java	6 Sep 2002 17:50:27 -0000	1.10
  @@ -101,7 +101,7 @@
       olist.addElement(src);
   
   
  -    ByteArrayOutputStream tmpout = new ByteArrayOutputStream();
  +    ByteArrayOutputStream tmpout = new ByteArrayOutputStream(4096);
       // removed: GDA 4/17/2001 PipedOutputStream tmpout  = new PipedOutputStream();
       // removed: GDA 4/17/2001 PipedInputStream tmpin  = new PipedInputStream();
   
  
  
  

Mime
View raw message