Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- reading (which is ok ill give it that
- public static String read(String folderName, String file, int lineNumber) {
- String read = null;
- try {
- in = new BufferedReader(new FileReader(folderName + "/" + file));
- while (lineNumber > 0) {
- read = in.readLine();
- lineNumber--;
- }
- in.close();
- } catch (Exception e) {
- System.err.println(e);
- }
- return read;
- }
- writing (which is very annoying considering you cant write to a specific line. it goes down the page and whatever line comes first it writes to)
- public static void write(String folderName, String file, String outString, boolean clear, boolean newLine) {
- try {
- if (!clear) {
- out = new BufferedWriter(new FileWriter(folderName + "/" + file, true));
- } else {
- out = new BufferedWriter(new FileWriter(folderName + "/" + file));
- }
- out.write(outString);
- if (newLine) {
- out.newLine();
- }
- out.close();
- } catch (Exception e) {
- System.err.println(e);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement