Browse Source

- remove useless object creation

- do not modify formal parameter


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271247 13f79535-47bb-0310-9956-ffa450edef68
master
Stephane Bailliez 23 years ago
parent
commit
ef5da3ccff
1 changed files with 9 additions and 9 deletions
  1. +9
    -9
      src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassPathLoader.java

+ 9
- 9
src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassPathLoader.java View File

@@ -199,16 +199,16 @@ public class ClassPathLoader {
* 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 @@ final class DirectoryLoader implements ClassPathLoader.FileLoader {

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 @@ final class DirectoryLoader implements ClassPathLoader.FileLoader {
}
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);
}


Loading…
Cancel
Save