ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sbaill...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode ClassPathLoader.java
Date Sat, 09 Feb 2002 20:04:22 GMT
sbailliez    02/02/09 12:04:22

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode
                        ClassPathLoader.java
  Log:
  - remove useless object creation
  - do not modify formal parameter
  
  Revision  Changes    Path
  1.7       +9 -9      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassPathLoader.java
  
  Index: ClassPathLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassPathLoader.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ClassPathLoader.java	26 Jan 2002 20:35:33 -0000	1.6
  +++ ClassPathLoader.java	9 Feb 2002 20:04:22 -0000	1.7
  @@ -199,16 +199,16 @@
        * brings time from 50s to 7s.
        */
       public static InputStream getCachedStream(InputStream is) throws IOException {
  -        is = new BufferedInputStream(is);
  -        byte[] buffer = new byte[8192];
  -        ByteArrayOutputStream baos = new ByteArrayOutputStream(2048);
  +        final InputStream bis = new BufferedInputStream(is);
  +        final byte[] buffer = new byte[8192];
  +        final ByteArrayOutputStream bos = new ByteArrayOutputStream(2048);
           int n;
  -        baos.reset();
  -        while ((n = is.read(buffer, 0, buffer.length)) != -1) {
  -            baos.write(buffer, 0, n);
  +        bos.reset();
  +        while ((n = bis.read(buffer, 0, buffer.length)) != -1) {
  +            bos.write(buffer, 0, n);
           }
           is.close();
  -        return new ByteArrayInputStream(baos.toByteArray());
  +        return new ByteArrayInputStream(bos.toByteArray());
       }
   }
   
  @@ -288,7 +288,7 @@
   
       public ClassFile[] getClasses() throws IOException {
           Vector v = new Vector(127);
  -        Vector files = listFiles(directory, new ClassFilter(), true);
  +        Vector files = listFiles(directory, CLASS_FILTER, true);
           final int filesCount = files.size();
           for (int i = 0; i < filesCount; i++) {
               File file = (File) files.elementAt(i);
  @@ -347,7 +347,7 @@
           }
           files = null;   // we don't need it anymore
           if (recurse) {
  -            String[] subdirs = directory.list(new DirectoryFilter());
  +            String[] subdirs = directory.list(DIRECTORY_FILTER);
               for (int i = 0; i < subdirs.length; i++) {
                   listFilesTo(list, new File(directory, subdirs[i]), filter, recurse);
               }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message