Package open.java.toolkit.files
Class FileParser
- java.lang.Object
-
- open.java.toolkit.files.FileParser
-
public class FileParser extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description FileParser(java.lang.String filePath, java.lang.String commentCharacter, java.lang.String separator, boolean removeSpaces, int index)Constructor for this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetBoolean(java.lang.String key)Gets a boolean from a specific key.java.lang.String[]getFile(java.lang.String key)Gets a file's content from a specific key.intgetInt(java.lang.String key)Gets an integer from a specific key.java.lang.StringgetString(java.lang.String key)Gets a string from a specific key.voidsetBoolean(java.lang.String key, boolean value)Sets a boolean to a new one.voidsetInt(java.lang.String key, int value)Sets an integer to a new one.voidsetString(java.lang.String key, java.lang.String value)Sets a string to a new one.
-
-
-
Constructor Detail
-
FileParser
public FileParser(java.lang.String filePath, java.lang.String commentCharacter, java.lang.String separator, boolean removeSpaces, int index)Constructor for this class.- Parameters:
filePath- The file to read.commentCharacter- The character which is used as a comment or "line to ignore" character.separator- The separator character used to separate the keys and values.removeSpaces- Whether or not to remove spaces when reading lines.index- The index which is used with the separator. Generally, 0 is the key and 1 is the value.
-
-
Method Detail
-
getString
public java.lang.String getString(java.lang.String key)
Gets a string from a specific key.- Parameters:
key- The key used to get the string.- Returns:
- The string.
-
setString
public void setString(java.lang.String key, java.lang.String value)Sets a string to a new one.- Parameters:
key- The key used to get the string in the file.value- The new string used to replace the old one.
-
getInt
public int getInt(java.lang.String key)
Gets an integer from a specific key.- Parameters:
key- The key used to get the integer.- Returns:
- The integer.
-
setInt
public void setInt(java.lang.String key, int value)Sets an integer to a new one.- Parameters:
key- The key used to get the integer in the file.value- The new integer used to replace the old one.
-
getBoolean
public boolean getBoolean(java.lang.String key)
Gets a boolean from a specific key.- Parameters:
key- The key used to get the boolean.- Returns:
- The boolean.
-
setBoolean
public void setBoolean(java.lang.String key, boolean value)Sets a boolean to a new one.- Parameters:
key- The key used to get the boolean in the file.value- The new boolean used to replace the old one.
-
getFile
public java.lang.String[] getFile(java.lang.String key)
Gets a file's content from a specific key.- Parameters:
key- The key used to get the file's content.- Returns:
- The file's content as a string array.
-
-