public class LevelParser
extends java.lang.Object
Modifier and Type | Class | Description |
---|---|---|
static class |
LevelParser.Exception |
Exception thrown when level data is invalid.
|
Constructor | Description |
---|---|
LevelParser() |
Modifier and Type | Method | Description |
---|---|---|
static Level |
loadLevelFromResource(java.lang.String path) |
Loads level data from a file and parses it.
|
static Level |
loadLevelFromURL(java.lang.String source) |
Loads level data from a URL and parses it.
|
static Level |
parseLines(java.lang.String[] lines) |
Parses given level data.
|
static java.lang.String[] |
readLinesFromResource(java.lang.String filename) |
Loads level data from a given resource.
|
static java.lang.String[] |
readLinesFromURL(java.lang.String source) |
Loads level data from a URL.
|
public static Level parseLines(java.lang.String[] lines) throws LevelParser.Exception
lines
- lines containg level data.LevelParser.Exception
- when the level data is invalid.public static java.lang.String[] readLinesFromResource(java.lang.String filename) throws java.io.IOException, java.lang.NullPointerException
filename
- path to a resource with level data.java.io.IOException
- when resource is unavailable.java.lang.NullPointerException
- when resource is unavailable.public static java.lang.String[] readLinesFromURL(java.lang.String source) throws java.io.IOException
source
- path to a remote file with level data.java.io.IOException
- when remote file is unavailable.public static Level loadLevelFromResource(java.lang.String path) throws java.io.IOException, LevelParser.Exception
path
- path to a resource file with level data.java.io.IOException
- when file is unavailable.LevelParser.Exception
- when level data is invalid.public static Level loadLevelFromURL(java.lang.String source) throws java.io.IOException, LevelParser.Exception
source
- path to a remote file with level data.java.io.IOException
- when file is unavailable.LevelParser.Exception
- when level data is invalid.