fun loadStrings(filename: String): Array<String?>? { val `is`: InputStream = createInput(filename) if (`is` != null) return loadStrings(`is`) System.err.println("The file \"$filename\" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.") return null }
Load data from a file and shove it into a String array . < p/ > Exceptions are handled internally , when an error , occurs , an exception is printed to the console and 'null ' is returned , but the program continues running . This is a tradeoff between 1 ) showing the user that there was a problem but 2 ) not requiring that all i/o code is contained in try/catch blocks , for the sake of new users ( or people who are just trying to get things done in a `` scripting '' fashion . If you want to handle exceptions , use Java methods for I/O .