1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.tobago.context;
21
22 public class ResourceUtils {
23
24 public static final char FOLDER_SEPARATOR = '/';
25 public static final char SEPARATOR = '-';
26 public static final char DOT = '.';
27
28 public static final String GIF = "gif";
29
30 public static String createString(String folder, String component, String name, String postfix, String extension) {
31 return new StringBuilder()
32 .append(folder)
33 .append(FOLDER_SEPARATOR)
34 .append(component)
35 .append(SEPARATOR)
36 .append(name)
37 .append(SEPARATOR)
38 .append(postfix)
39 .append(DOT)
40 .append(extension)
41 .toString();
42 }
43
44 public static String createString(String folder, String component, String name, String extension) {
45 return new StringBuilder()
46 .append(folder)
47 .append(FOLDER_SEPARATOR)
48 .append(component)
49 .append(SEPARATOR)
50 .append(name)
51 .append(DOT)
52 .append(extension)
53 .toString();
54 }
55
56 public static String addPostfixToFilename(String filename, String postfix) {
57 int dotIndex = filename.lastIndexOf('.');
58 String name = filename.substring(0, dotIndex);
59 String extension = filename.substring(dotIndex);
60 return new StringBuilder()
61 .append(name)
62 .append(postfix)
63 .append(extension)
64 .toString();
65 }
66
67 private ResourceUtils() {
68 }
69
70 }