20 package net.sf.gridarta.model.resource;
22 import java.io.BufferedReader;
24 import java.io.FileNotFoundException;
25 import java.io.IOException;
26 import java.io.InputStream;
27 import java.io.InputStreamReader;
28 import java.io.Reader;
30 import java.util.HashMap;
31 import java.util.List;
46 import net.
sf.japi.swing.action.ActionBuilder;
47 import net.
sf.japi.swing.action.ActionBuilderFactory;
48 import org.apache.log4j.Category;
49 import org.apache.log4j.Logger;
50 import org.jetbrains.annotations.NotNull;
51 import org.jetbrains.annotations.Nullable;
66 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
125 try (InputStream inputStream = animationsURL.openStream()) {
127 try (Reader bufferedReader =
new BufferedReader(reader)) {
132 }
catch (
final IOException ex) {
138 if (
LOG.isInfoEnabled()) {
139 LOG.info(
"Loaded " + (
animationObjects.
size() - animationObjectsSize) +
" animations from '" + animationsURL +
"'.");
141 }
catch (
final FileNotFoundException ex) {
157 archFaceProvider.addInfo(facename, filename);
180 for (
int t = 0; t <
name.length() && secondDot == 0; t++) {
181 if (
name.charAt(t) ==
'.') {
190 if (firstDot != 0 && secondDot != 0) {
191 return name.substring(0, firstDot) +
name.substring(secondDot,
name.length() - 4);
193 return name.substring(0,
name.length() - 4);
197 return name.substring(0,
name.length() - 4);
217 protected static Map<String, String>
loadAnimTree(@NotNull
final URL url)
throws IOException {
218 final Map<String, String> animations;
219 try (InputStream inputStream = url.openStream()) {
221 try (BufferedReader bufferedReader =
new BufferedReader(reader)) {
226 if (
LOG.isInfoEnabled()) {
227 LOG.info(
"Loaded " + animations.size() +
" animations from '" + url +
"'.");
239 private static Map<String, String>
loadAnimTree(@NotNull
final BufferedReader reader)
throws IOException {
240 final Map<String, String> animations =
new HashMap<>();
242 final String line = reader.readLine();
246 final int index = line.lastIndexOf(
'/');
247 final String
name = line.substring(index + 1);
248 animations.put(
name, line);