-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMyFolder.java
More file actions
77 lines (68 loc) · 1.64 KB
/
MyFolder.java
File metadata and controls
77 lines (68 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import java.io.File;
import java.util.List;
public class MyFolder {
private FileAggregate folder;// = new File("");
private FileIterator folderit;
private File tfile;
private int filesCount;
public MyFolder (String fpath) {
tfile = new File(fpath);
filesCount = 0;
if(tfile.isDirectory()) {
folder = new FileAggregate(fpath);
File[] listOfFiles = tfile.listFiles();
for (File f:listOfFiles) {
folder.add(f);
filesCount++;
}
folderit = (FileIterator) folder.iterator();
}
else {
System.out.println("Path is not a directory!");
}
}
public List getList() {
return folder.getList();
}
public File getFile() {
return tfile;
}
public File getFileAtIndex(int index) {
return folderit.getIndex(index);
}
public int getCount() {
return this.filesCount;
}
public void listAll(){
FileShow fshow;// = new FileShow(folderit.next());
while (folderit.hasNext()){
fshow = new FileShow(folderit.next());
System.out.println(fshow.getDetail());
}
}
// public void listAFile(int index, String args) {
// char[] chars = args.toLowerCase().toCharArray();
// File tfile = folderit.getIndex(index);
// FileShow fshow = new FileShow(tfile);
// String tString = new String(fshow.getDetail());
// for(int i = 0; i < args.length(); i++){
// switch(chars[i]) {
// case 's':
// {
// SizeDecoShow sizedeco = new SizeDecoShow(tfile);
// tString += sizedeco.getDetail();
// break;
// }
// case 'm':
// {
// ModfDecoShow modfdeco = new ModfDecoShow(tfile);
// tString += modfdeco.getDetail();
// break;
// }
// default:
// break;
// }
// }
// System.out.println(tString);
// }
}