tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From billbar...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/compat Jdk14Compat.java JdkCompat.java
Date Thu, 14 Aug 2003 06:36:02 GMT
billbarker    2003/08/13 23:36:02

  Modified:    util/java/org/apache/tomcat/util/compat Jdk14Compat.java
                        JdkCompat.java
  Log:
  Adding a 'split' method to JdkCompat.
  
  The 1.3.x JVM treats the pattern as a literal (and not as an RE) for now, since I don't
want to introduce more dependecies for j-t-c.
  
  Also, not currently used (so the net effect is to add a few bytes).  Adding it per a suggestion
from Costin.
  
  Revision  Changes    Path
  1.6       +6 -4      jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/compat/Jdk14Compat.java
  
  Index: Jdk14Compat.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/compat/Jdk14Compat.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Jdk14Compat.java	19 Jul 2003 10:03:29 -0000	1.5
  +++ Jdk14Compat.java	14 Aug 2003 06:36:02 -0000	1.6
  @@ -148,5 +148,7 @@
           return trace.toString();
       }
   
  -
  +    public  String [] split(String path, String pat) {
  +        return path.split(pat);
  +    }
    }
  
  
  
  1.10      +31 -3     jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/compat/JdkCompat.java
  
  Index: JdkCompat.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/compat/JdkCompat.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JdkCompat.java	19 Jul 2003 10:04:05 -0000	1.9
  +++ JdkCompat.java	14 Aug 2003 06:36:02 -0000	1.10
  @@ -66,6 +66,7 @@
   import java.io.IOException;
   import java.net.URL;
   import java.net.MalformedURLException;
  +import java.util.Vector;
   import java.io.PrintWriter;
   import java.io.StringWriter;
   
  @@ -220,5 +221,32 @@
           }
       }
   
  +    /**
  +     * Splits a string into it's components.
  +     * @param path String to split
  +     * @param pat Pattern to split at
  +     * @return the components of the path
  +     */
  +    public  String [] split(String path, String pat) {
  +        Vector comps = new Vector();
  +        int pos = path.indexOf(pat);
  +        int start = 0;
  +        while( pos >= 0 ) {
  +            if(pos > start ) {
  +                String comp = path.substring(start,pos);
  +                comps.add(comp);
  +            }
  +            start = pos + pat.length();
  +            pos = path.indexOf(pat,start);
  +        }
  +        if( start < path.length()) {
  +            comps.add(path.substring(start));
  +        }
  +        String [] result = new String[comps.size()];
  +        for(int i=0; i < comps.size(); i++) {
  +            result[i] = (String)comps.elementAt(i);
  +        }
  +        return result;
  +    }
   
    }
  
  
  

Mime
View raw message