Code: Select all
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class ReadInLinks {
static List<String> sumoLinks = new ArrayList<String>();
static List<String> slideLinks = new ArrayList<String>();
static List<String> castleLinks = new ArrayList<String>();
static List<String> obstacleLinks = new ArrayList<String>();
static void readInSumo() throws FileNotFoundException {
File readFile = new File("./WebContent/images/SumoLinks.txt");
Scanner sc = new Scanner(readFile);
while (sc.hasNextLine()) {
sumoLinks.add(sc.nextLine());
}
}
static void readInSlide() throws FileNotFoundException {
File readFile = new File("./WebContent/images/SlidesLinks.txt");
Scanner sc = new Scanner(readFile);
while (sc.hasNextLine()) {
slideLinks.add(sc.nextLine());
}
}
static void readInCastle() throws FileNotFoundException {
File readFile = new File("./WebContent/images/BounceCastleLinks.txt");
Scanner sc = new Scanner(readFile);
while (sc.hasNextLine()) {
castleLinks.add(sc.nextLine());
}
}
static void readInObstacle() throws FileNotFoundException {
File readFile = new File("./WebContent/images/ObstacleLinks.txt");
Scanner sc = new Scanner(readFile);
while (sc.hasNextLine()) {
obstacleLinks.add(sc.nextLine());
}
}
}
I am looking to display that images that array list points to so that if we decide to add more images later we won't need to hard code them in the "Client" can simply add the image to the file and then a link that points to it. All the examples I have found are for collecting blobs from database but for this project we don't have a DB we just have a folder with the images in them.
I am so confused.
Any help will be awesome.
Kind regards
Matthew