|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.newdawn.slick.SavedState
public class SavedState
A utility to allow game setup/state to be stored locally. This utility will adapt to the current enviornment (webstart or file based). Note that this will not currently work in an applet.
Constructor Summary | |
---|---|
SavedState(java.lang.String fileName)
Create and Test to see if the app is running as webstart or local app and select the appropriate muffin type |
Method Summary | |
---|---|
void |
clear()
Will delete all current data held in Score |
double |
getNumber(java.lang.String nameOfField)
Get number stored at given location |
double |
getNumber(java.lang.String nameOfField,
double defaultValue)
Get number stored at given location |
java.lang.String |
getString(java.lang.String nameOfField)
Get the String at the given location |
java.lang.String |
getString(java.lang.String nameOfField,
java.lang.String defaultValue)
Get the String at the given location |
void |
load()
Load the data from file/muffin |
void |
save()
Save the stored data to file/muffin |
void |
setNumber(java.lang.String nameOfField,
double value)
Save the given value at the given location will overwrite any previous value at this location |
void |
setString(java.lang.String nameOfField,
java.lang.String value)
Save the given value at the given location will overwrite any previous value at this location |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SavedState(java.lang.String fileName) throws SlickException
fileName
- name of muffin where data will be saved
SlickException
- Indicates a failure to load the stored stateMethod Detail |
---|
public double getNumber(java.lang.String nameOfField)
nameOfField
- The name of the number to retrieve
public double getNumber(java.lang.String nameOfField, double defaultValue)
nameOfField
- The name of the number to retrievedefaultValue
- The value to return if the specified value hasn't been set
public void setNumber(java.lang.String nameOfField, double value)
nameOfField
- The name to store the value againstvalue
- The value to storepublic java.lang.String getString(java.lang.String nameOfField)
nameOfField
- location of string
public java.lang.String getString(java.lang.String nameOfField, java.lang.String defaultValue)
nameOfField
- location of stringdefaultValue
- The value to return if the specified value hasn't been set
public void setString(java.lang.String nameOfField, java.lang.String value)
nameOfField
- location to store intvalue
- The value to storepublic void save() throws java.io.IOException
java.io.IOException
- Indicates it wasn't possible to store the statepublic void load() throws java.io.IOException
java.io.IOException
- Indicates it wasn't possible to load the statepublic void clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |