-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotesManager.java
More file actions
50 lines (28 loc) · 857 Bytes
/
NotesManager.java
File metadata and controls
50 lines (28 loc) · 857 Bytes
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
package secureNotepad;
import java.io.File;
import java.util.ArrayList;
import utils.Preferences;
public class NotesManager {
public NotesManager() {
}
public static File[] getNotesInPath() {
return utils.FileIOUtil.readFolder(Preferences.NOTES_DIR_PATH).listFiles();
}
public static File getNoteInPath(String name) {
File[] files = utils.FileIOUtil.readFolder(Preferences.NOTES_DIR_PATH).listFiles();
File fileToReturn = null;
for(File file : files) {
if(file.getName().toLowerCase() == name.toLowerCase()) {
fileToReturn = file;
}
}
return fileToReturn;
}
public static ArrayList<String> getNotesFilenamesInPath() {
ArrayList<String> filenames = new ArrayList<String>();
for(File file : getNotesInPath()) {
filenames.add(file.getName());
}
return filenames;
}
}