filevisitor

Searching thousands of files via a thread and “tree walker”, writing matches to JTable results in unresponsiveness

六月ゝ 毕业季﹏ 提交于 2020-01-06 04:20:06
问题 I have revised my Windows 7 search program to write matched files to a JTable . Prior to this I was writing to a JTextArea . The output was ugly; hence JTable output. But with JTable , the program becomes unresponsive from time to time if searching thousands of files. (Not so with JTextArea . Very smooth.) My question is how to improve responsiveness. I have one Thread that is invoked in main and "walks the file tree" from a given node: public static void main(String args[]) { EventQueue

Searching thousands of files via a thread and “tree walker”, writing matches to JTable results in unresponsiveness

a 夏天 提交于 2020-01-06 04:19:07
问题 I have revised my Windows 7 search program to write matched files to a JTable . Prior to this I was writing to a JTextArea . The output was ugly; hence JTable output. But with JTable , the program becomes unresponsive from time to time if searching thousands of files. (Not so with JTextArea . Very smooth.) My question is how to improve responsiveness. I have one Thread that is invoked in main and "walks the file tree" from a given node: public static void main(String args[]) { EventQueue

In Java how do I create a structured tree using FileVisitor

泄露秘密 提交于 2020-01-06 03:31:06
问题 Given a starting path I want to create a tree like object representing the filesystem using Java, showing all the folders down to level x but not ordinary files. . So using FileVisitor I know that every time just before Im going to browse a new subfolder that the preVisitDirectory() method will be called and once it had completed parsing all its children the postVisitDirectory() will be called, but my problem is knowing how to attach this directory to its parent. i.e in my case I want to

Swingworker with FileVisitor class and walkFileTree(), which iterates internally over a “set” of files in a directory tree; where to publish()?

£可爱£侵袭症+ 提交于 2019-12-04 05:33:46
问题 It seems like the long-running tree walker task should be defined in a class like so: public class TreeWalker extends SwingWorker<Void,String> implements FileVisitor<Path> And begun somewhere like so: TreeWalker walker = (new TreeWalker()); walker.execute(); The long-running task is not only initiated by but completely carried out by a single call to walkFileTree() , a method in the Files class. So surely the call to it has to be in doInBackGround() . protected Void doInBackground() throws

Swingworker with FileVisitor class and walkFileTree(), which iterates internally over a “set” of files in a directory tree; where to publish()?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 08:37:34
It seems like the long-running tree walker task should be defined in a class like so: public class TreeWalker extends SwingWorker<Void,String> implements FileVisitor<Path> And begun somewhere like so: TreeWalker walker = (new TreeWalker()); walker.execute(); The long-running task is not only initiated by but completely carried out by a single call to walkFileTree() , a method in the Files class. So surely the call to it has to be in doInBackGround() . protected Void doInBackground() throws Exception { Files.walkFileTree(SearchyGUI.p , this); return null; } Note that walkTreeFile() internally

The correct way to use FileVisitor in java

匆匆过客 提交于 2019-11-29 15:21:58
问题 I am trying to step through an entire path and its single layer of sub directories. For each file, I need to read five data fields and output them to a delimited text file. I'm able to read from a single text file and validate my output on screen; after that I'm stuck. I cannot seem to to find the right parameters for FileVisit. Some specific questions are comments in my code posted below. And although I'm no nearly that far yes, I'd like to get some idea for writing to an output file, namely