package playground; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; import java.io.File; import java.io.*; import java.io.FileNotFoundException; import java.util.LinkedList; import java.util.Locale; import java.util.Scanner; import java.nio.file.Path; import java.nio.file.Paths; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; public class Animation { public LinkedList fileList = null; public LinkedList showtimeList = null; public LinkedList imageList = null; private static Logger logger = LogManager.getLogger(Animation.class); public Animation(String datName) { Scanner scanner; this.fileList = new LinkedList(); this.showtimeList = new LinkedList(); this.imageList = new LinkedList(); try { scanner = new Scanner(new File(datName), "UTF-8"); scanner.useLocale(Locale.GERMANY); String zeile; double zeit; while (scanner.hasNext()) { if (scanner.hasNextDouble()) { zeit = scanner.nextDouble(); showtimeList.add(zeit); } else { zeile = scanner.next(); Path basePath = Paths.get(datName); String file = basePath.getParent().toString() + "/" + zeile; fileList.add(file); try { this.imageList.add(ImageIO.read(new File(file))); logger.info("img added " + file); } catch (IOException e) { logger.warn(file + " not found!!"); } logger.trace(basePath.getParent().toString() + "/" + zeile); } } scanner.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } } public LinkedList getFileList() { return this.fileList; } public LinkedList getShowtimeList() { return this.showtimeList; } public LinkedList getImageList() { return this.imageList; } }