|
@@ -208,6 +208,35 @@ public abstract class ResourceManager {
|
208
|
208
|
final String directory) throws IOException {
|
209
|
209
|
extractResources(resourcesPrefix, directory, true);
|
210
|
210
|
}
|
|
211
|
+
|
|
212
|
+ /**
|
|
213
|
+ * Extracts files ending with the given suffix
|
|
214
|
+ *
|
|
215
|
+ * @param newDir Directory to extract to.
|
|
216
|
+ * @param suffix Suffix to extract
|
|
217
|
+ *
|
|
218
|
+ * @throws IOException if the resources failed to extract
|
|
219
|
+ */
|
|
220
|
+ public final void extractResoucesEndingWith(final File newDir,
|
|
221
|
+ final String suffix) throws IOException {
|
|
222
|
+ final Map<String, byte[]> resources = getResourcesEndingWithAsBytes(
|
|
223
|
+ suffix);
|
|
224
|
+ for (Entry<String, byte[]> resource : resources.entrySet()) {
|
|
225
|
+ final String key = resource.getKey();
|
|
226
|
+ final String resourceName = key.substring(key.lastIndexOf('/'), key.
|
|
227
|
+ length());
|
|
228
|
+
|
|
229
|
+ final File newFile = new File(newDir, resourceName);
|
|
230
|
+
|
|
231
|
+ if (!newFile.isDirectory()) {
|
|
232
|
+ if (newFile.exists()) {
|
|
233
|
+ newFile.delete();
|
|
234
|
+ }
|
|
235
|
+ ResourceManager.getResourceManager().resourceToFile(resource.
|
|
236
|
+ getValue(), newFile);
|
|
237
|
+ }
|
|
238
|
+ }
|
|
239
|
+ }
|
211
|
240
|
|
212
|
241
|
/**
|
213
|
242
|
* Checks if a resource exists.
|