1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.util; |
12 | |
|
13 | |
import java.io.File; |
14 | |
|
15 | |
public class FilenameUtils extends org.apache.commons.io.FilenameUtils |
16 | |
{ |
17 | |
public static File fileWithPathComponents(String[] pathComponents) |
18 | |
{ |
19 | 6 | if (pathComponents == null) |
20 | |
{ |
21 | 2 | return null; |
22 | |
} |
23 | |
|
24 | 4 | StringBuffer buf = new StringBuffer(64); |
25 | 20 | for (int i = 0; i < pathComponents.length; i++) |
26 | |
{ |
27 | 16 | String component = pathComponents[i]; |
28 | 16 | if (component == null) |
29 | |
{ |
30 | 2 | continue; |
31 | |
} |
32 | |
|
33 | 14 | buf.append(component); |
34 | 14 | if (i < pathComponents.length - 1) |
35 | |
{ |
36 | 10 | buf.append(File.separator); |
37 | |
} |
38 | |
} |
39 | 4 | return FileUtils.newFile(buf.toString()); |
40 | |
} |
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
private FilenameUtils() |
46 | |
{ |
47 | 0 | super(); |
48 | 0 | } |
49 | |
} |
50 | |
|
51 | |
|