-
Notifications
You must be signed in to change notification settings - Fork 6
Text Files
Text Files supports writing and reading of text files.
Many teams have been forced to develop their own file reading and writing, as nothing exists already to do so easily. Much of the actual behaviour of file writing is obscure and strange. Our text file support offers a simplified version of the implementations that other teams have done. It offers a standard of behaviour that will always be there for use.
How to use Text Files
There are only two real things to do with text files: Writing and Reading. Reading is pretty easy, it just reads the file's content. Use getTextFromFile(String fileName) to do that.
The much more difficult problem with text files in writing. There are strange behaviours of the squawk IO that make it difficult to predict. writeAsFile(String fileName, String msg) will replace all of the contents of a file with the string. If you want to append a string to that file, use appendToFile(String fileName, String msg). It will attach the string to the end of the file. appendToNewLine(String fileName, String msg) will append the string to a new line at the end of the file.
All of these functions abstract away from the IO behind them. They are tested and trustable to perform their functions. Whenever an error happens, it will be printed to the console. No errors are thrown by the methods because they shouldn't be something you worry about. An error would be something you can't deal with or fix. getTextFromFile(String fileName) will return null if the file doesn't exist or something goes wrong.
Report bugs if you find any!