-
-
Save sasajib/c50f66bad2b64410ef16 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Imports required | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.util.Scanner; | |
/** | |
* Read in a file. | |
* | |
* @param path The explicit path to the file to read | |
* @return The contents of the file as a string | |
* @throws FileNotFoundException If there's a problem reading the file. | |
*/ | |
final public static String readFile(String path) throws FileNotFoundException | |
{ | |
return new Scanner(new File(path)).useDelimiter("\\Z").next(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment