Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String readTextFile(String path)
- {
- String content = null;
- try
- {
- File file = new File(path);
- Scanner scanner = new Scanner(file);
- content = "";
- while (scanner.hasNextLine())
- {
- String line = scanner.nextLine();
- content += line + "\r\n";
- }
- }
- catch (Exception ex)
- {
- }
- return content;
- }
- public static boolean writeTextFile(String path, String content)
- {
- boolean success = false;
- try
- {
- File file = new File(path);
- PrintWriter writer = new PrintWriter(path);
- writer.print(content);
- writer.close();
- success = true;
- }
- catch (Exception ex) {}
- return success;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement