Author: noelr
Date: 2009-08-14 03:40:16 -0700 (Fri, 14 Aug 2009)
New Revision: 17822

Modified:
   cytoscape/trunk/src/cytoscape/util/ZipUtil.java
Log:
Tweak filename regexp matching for efficiency

Modified: cytoscape/trunk/src/cytoscape/util/ZipUtil.java
===================================================================
--- cytoscape/trunk/src/cytoscape/util/ZipUtil.java     2009-08-14 10:38:50 UTC 
(rev 17821)
+++ cytoscape/trunk/src/cytoscape/util/ZipUtil.java     2009-08-14 10:40:16 UTC 
(rev 17822)
@@ -57,6 +57,8 @@
 import cytoscape.task.TaskMonitor;
 import cytoscape.task.Task;
 import cytoscape.task.ui.JTask;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * Compression-related methods mainly for Session Writer.<br>
@@ -378,14 +380,20 @@
         */
        public static List<ZipEntry> getAllFiles(String zipName, String 
fileNameRegEx) throws IOException {
                List<ZipEntry> Matching = new ArrayList<ZipEntry>();
-               
+        Pattern p;
+               Matcher m;
+
+        p = Pattern.compile(fileNameRegEx);
+        m = p.matcher("");
+
                ZipFile Zip = new ZipFile(zipName);
         try {
             Enumeration Entries = Zip.entries();
 
             while (Entries.hasMoreElements()) {
                 ZipEntry CurrentEntry = (ZipEntry) Entries.nextElement();
-                if (CurrentEntry.getName().matches(fileNameRegEx)) {
+                m.reset(CurrentEntry.getName());
+                if (m.matches()) {
                     Matching.add(CurrentEntry);
                 }
             }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to