public interface PlayerData
Field annotations to be
serialized/deserialized properly| Modifier and Type | Method and Description |
|---|---|
void |
createDirectory(java.lang.String... path)
Creates a directory within in the player data location
|
boolean |
delete(java.lang.String... path)
Deletes a file or directory within in the player data location
|
com.badlogic.gdx.files.FileHandle |
getFileHandle(java.lang.String... filepath)
Returns a
FileHandle of a file in the player data location |
boolean |
hasDirectory(java.lang.String... path)
Checks if the directory exists in the player data location
|
boolean |
hasFile(java.lang.String... filepath)
Checks if the file exists in the player data location
|
<T extends GameDataSerializable> |
readBytes(T result,
java.lang.String... filepath)
Reads a file from the player data location as a
GameDataSerializable instance |
<T> T |
readJson(java.lang.Class<T> clazz,
java.lang.String... filepath)
Converts JSON from a file into an object.
|
java.lang.String |
readString(java.lang.String... filepath)
Reads the contents of a file in the player data location into a
String |
<T> T |
readXml(java.lang.Class<T> clazz,
java.lang.String... filepath)
Converts XML from a file into an object.
|
void |
wipe()
Wipes all data within the player data location
|
<T extends GameDataSerializable> |
writeBytes(T obj,
java.lang.String... filepath)
Writes a
GameDataSerializable object to a file in the player data location |
<T> void |
writeJson(T object,
java.lang.String... filepath)
Writes an object as JSON to a file.
|
void |
writeString(java.lang.String content,
java.lang.String... filepath)
Writes a
String to a file in the player data location |
<T> void |
writeXml(T object,
java.lang.String... filepath)
Writes an object as XML to a file.
|
com.badlogic.gdx.files.FileHandle getFileHandle(java.lang.String... filepath)
FileHandle of a file in the player data locationfilepath - The path to the file. This will be resolved as a path within the player data location.java.lang.String readString(java.lang.String... filepath)
throws PlayerDataException
Stringfilepath - The path to the file. This will be resolved as a path
within the player data location.PlayerDataException - Thrown if the file does not existvoid writeString(java.lang.String content,
java.lang.String... filepath)
throws PlayerDataException
String to a file in the player data locationcontent - The String to be written to the filefilepath - The path to the file. This will be resolved as a path
within the player data location.PlayerDataException - Thrown if the player data location cannot be accessed or the
data cannot be written to the file.<T extends GameDataSerializable> void readBytes(T result, java.lang.String... filepath) throws PlayerDataException
GameDataSerializable instanceT - The type of the objectresult - The instance to read tofilepath - The path to the file. This will be resolved as a path within the player data location.PlayerDataException - Thrown if the player data location cannot be accessed or the
* data cannot be written to the file.<T extends GameDataSerializable> void writeBytes(T obj, java.lang.String... filepath) throws PlayerDataException
GameDataSerializable object to a file in the player data locationT - The type of the objectobj - The object to write to the filefilepath - The path to the file. This will be resolved as a path within the player data location.PlayerDataException - Thrown if the player data location cannot be accessed or the data cannot be written to the file.<T> T readXml(java.lang.Class<T> clazz,
java.lang.String... filepath)
throws PlayerDataException
clazz - The object type to convert the XML intofilepath - The path to the XML file. This will be resolved as a path
within the player data location.PlayerDataException - Thrown if the XML is invalid, the file does not exist or the
player data location cannot be accessed.<T> void writeXml(T object,
java.lang.String... filepath)
throws PlayerDataException
object - The object to be written to the filefilepath - The path to the XML file. This will be resolved as a path
within the player data location.PlayerDataException - Thrown if the player data location cannot be accessed or the
data cannot be written to the file.<T> T readJson(java.lang.Class<T> clazz,
java.lang.String... filepath)
throws PlayerDataException
clazz - The object type to convert the JSON intofilepath - The path to the JSON file. This will be resolved as a path
within the player data location.PlayerDataException - Thrown if the XML is invalid, the file does not exist or the
player data location cannot be accessed.<T> void writeJson(T object,
java.lang.String... filepath)
throws PlayerDataException
object - The object to be written to the filefilepath - The path to the JSON file. This will be resolved as a path
within the player data location.PlayerDataException - Thrown if the player data location cannot be accessed or the
data cannot be written to the file.boolean hasFile(java.lang.String... filepath)
throws PlayerDataException
filepath - The path to the file within the player data locationPlayerDataException - Thrown if the player data location cannot be accessedboolean hasDirectory(java.lang.String... path)
throws PlayerDataException
path - The path to the directory within the player data locationPlayerDataException - Thrown if the player data location cannot be accessedvoid createDirectory(java.lang.String... path)
throws PlayerDataException
path - The path to the directory within the player data locationPlayerDataException - Thrown if the player data location cannot be accessed or the
directory could not be createdboolean delete(java.lang.String... path)
throws PlayerDataException
path - The path to the file or directory within the player data locationPlayerDataException - Thrown if the player data location cannot be accessed or the
file/directory could not be deletedvoid wipe() throws PlayerDataException
PlayerDataException - Thrown if the player data location cannot be accessed or the
data could not be wiped