Paste Xaf9h

Submitted on 1 August 2015 at 02:24 UTC
824 views

Section 1 (java)

public static boolean remove (String oreDict) {
        boolean success = false;
        try {
            File temp = new File(configFile.getAbsolutePath()+".tmp");
            BufferedWriter out = new BufferedWriter(new FileWriter(temp));
            Scanner scn = new Scanner(configFile);
            while (scn.hasNextLine()) {
                String line = scn.nextLine();
                if (!line.startsWith(oreDict)) out.write(line+"\n");
            }
            scn.close();
            out.close();
            configFile.delete();
            success = temp.renameTo(configFile);
            if (success) conversions.remove(oreDict);
        } catch (IOException e) {}
        return success;
    }

Raw · Download

Pastee