nu.dll.pong
Class LevelLoader

java.lang.Object
  |
  +--nu.dll.pong.LevelLoader

public class LevelLoader
extends java.lang.Object

Loads level data from a text file or input stream. See data/levels.txt in the jar file for samples.


Constructor Summary
LevelLoader(java.io.File f)
          Loads level data from the given file.
LevelLoader(java.io.InputStream is)
          Loads level data from the given InputStream.
 
Method Summary
 Level getLevel(int no)
          Returns the level with the given number or null if that level isn't available.
 int levelCount()
          Returns the total number of levels loaded into this object.
 Level randomLevel()
          Generates and returns a random level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LevelLoader

public LevelLoader(java.io.File f)
            throws java.io.IOException
Loads level data from the given file.

LevelLoader

public LevelLoader(java.io.InputStream is)
            throws java.io.IOException
Loads level data from the given InputStream.
Method Detail

randomLevel

public Level randomLevel()
Generates and returns a random level.

getLevel

public Level getLevel(int no)
Returns the level with the given number or null if that level isn't available.

levelCount

public int levelCount()
Returns the total number of levels loaded into this object.