20 package net.sf.gridarta.model.io;
22 import java.io.BufferedReader;
24 import java.io.FileInputStream;
25 import java.io.IOException;
26 import java.io.InputStreamReader;
27 import java.util.ArrayList;
28 import java.util.Collections;
29 import java.util.List;
35 import org.jetbrains.annotations.NotNull;
48 private final List<G>
objects =
new ArrayList<>();
67 try (FileInputStream fis =
new FileInputStream(file)) {
69 try (BufferedReader br =
new BufferedReader(isr)) {
70 mapArchObject = mapArchObjectFactory.newMapArchObject(
false);
71 mapArchObjectParserFactory.newMapArchObjectParser().load(br, mapArchObject);
72 while (gameObjectParser.load(br, objects) != null) {
78 gameObjectParser.collectTempList(objects);
90 return Collections.unmodifiableList(objects);
static final String MAP_ENCODING
Encoding to use for maps and other data.
Default implementation of MapReader.
Factory for creating MapArchObject instances.
final List< G > objects
ArchObjects that are read from the map.
Base package of all Gridarta classes.
Interface for classes that read map files.
List< G > getGameObjects()
Reflects a game object (object on a map).
Utility-class for Gridarta's I/O.
GameObjects are the objects based on Archetypes found on maps.
final A mapArchObject
Contains the map arch object.
DefaultMapReader(@NotNull final MapArchObjectParserFactory< A > mapArchObjectParserFactory, @NotNull final MapArchObjectFactory< A > mapArchObjectFactory, @NotNull final GameObjectParser< G, A, R > gameObjectParser, @NotNull final File file)
Open a file for reading it as a map.
Interface for MapArchObjects.