Package org.odinware.odinrunes
Class TextHelper
java.lang.Object
org.odinware.odinrunes.TextHelper
The TextHelper class provides utility methods for working with text files.
- 
Constructor SummaryConstructorsConstructorDescriptionTextHelper(String filePath) Constructs a TextHelper object with the specified file path.
- 
Method SummaryModifier and TypeMethodDescriptionvoidAppends the assistant info to the file.voidappendOdinFirstInfo(String model, String date) Appends the Odin first info to the file.voidAppends the over info to the file.voidAppends the over info with an error to the file.voidappendStringToFile(String content) Appends the specified string content to the file.voidAppends the user info to the file.voidChecks if the file is empty, and populates it with default content if necessary.org.json.JSONArrayRetrieves the messages from the text file.static booleanisFirstLineValid(File file) Checks if the first line of the file contains valid Odin information.voidOpens the text file using the default system program.static StringreadIntoString(String filePath) voidwriteStringToFile(String content) Writes the specified string content to the file, overwriting its previous content.
- 
Constructor Details- 
TextHelperConstructs a TextHelper object with the specified file path.- Parameters:
- filePath- the path to the text file
 
 
- 
- 
Method Details- 
checkAndPopulateFileIfEmptypublic void checkAndPopulateFileIfEmpty()Checks if the file is empty, and populates it with default content if necessary.
- 
writeStringToFileWrites the specified string content to the file, overwriting its previous content.- Parameters:
- content- the string content to write
 
- 
appendStringToFileAppends the specified string content to the file.- Parameters:
- content- the string content to append
 
- 
appendOdinFirstInfoAppends the Odin first info to the file.- Parameters:
- model- the Odin model
- date- the date
 
- 
appendUserInfopublic void appendUserInfo()Appends the user info to the file.
- 
appendOverInfoWithErrorpublic void appendOverInfoWithError()Appends the over info with an error to the file.
- 
appendAssistantInfopublic void appendAssistantInfo()Appends the assistant info to the file.
- 
appendOverInfopublic void appendOverInfo()Appends the over info to the file.
- 
openTextFilepublic void openTextFile()Opens the text file using the default system program.
- 
getMessagespublic org.json.JSONArray getMessages()Retrieves the messages from the text file.- Returns:
- a JSONArray containing the messages
 
- 
isFirstLineValidChecks if the first line of the file contains valid Odin information.- Parameters:
- file- the file to check
- Returns:
- true if the first line is valid, false otherwise
 
- 
readIntoString
 
-