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
package com.baidu.ueditor.extend;
import java.util.Map;
import com.baidu.ueditor.define.State;
public class UEFileManager {
private String[] allowFiles = null;
private int count = 0;
private UeditorService ueditorService = null;
public UEFileManager(Map<String, Object> conf, UeditorService ueditorService) {
this.allowFiles = this.getAllowFiles(conf.get("allowFiles"));
this.count = (Integer) conf.get("count");
this.ueditorService = ueditorService;
}
public State listFile(int index) {
return ueditorService.listFile(this.allowFiles, index, this.count);
}
private String[] getAllowFiles(Object fileExt) {
String[] exts = null;
String ext = null;
if (fileExt == null) {
return new String[0];
}
exts = (String[]) fileExt;
for (int i = 0, len = exts.length; i < len; i++) {
ext = exts[i];
exts[i] = ext.replace(".", "");
}
return exts;
}
}