Last change
on this file since 6897 was 5943, checked in by cs025, 21 years ago |
Extensions to fix build
|
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
702 bytes
|
Line | |
---|
1 | package org.greenstone.gsdl3.gs3build;
|
---|
2 |
|
---|
3 | import java.io.File;
|
---|
4 |
|
---|
5 | public class FileCrawler
|
---|
6 | {
|
---|
7 | File root;
|
---|
8 | FileCrawlObserver observer;
|
---|
9 |
|
---|
10 | public FileCrawler(File file, FileCrawlObserver observer)
|
---|
11 | { this.root = file;
|
---|
12 | this.observer = observer;
|
---|
13 | }
|
---|
14 |
|
---|
15 | public void crawl()
|
---|
16 | { this.crawlDirectory(this.root);
|
---|
17 | }
|
---|
18 |
|
---|
19 | public boolean crawlDirectory(File file)
|
---|
20 | {
|
---|
21 | File [] children = file.listFiles();
|
---|
22 |
|
---|
23 | if (children == null) {
|
---|
24 | return true;
|
---|
25 | }
|
---|
26 |
|
---|
27 | for (int c = 0; c < children.length; c ++) {
|
---|
28 | if (children[c].isDirectory()) {
|
---|
29 | crawlDirectory(children[c]);
|
---|
30 | }
|
---|
31 | else
|
---|
32 | {
|
---|
33 | // TODO: process file
|
---|
34 | this.observer.processFile(children[c]);
|
---|
35 | }
|
---|
36 | }
|
---|
37 | return true;
|
---|
38 | }
|
---|
39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.