You are on page 1of 7

/*

* Decompiled with CFR 0_110.


*/
package util.file;
import
import
import
import
import
import
import
import
import
import
import

java.io.BufferedReader;
java.io.BufferedWriter;
java.io.File;
java.io.FileNotFoundException;
java.io.FileReader;
java.io.FileWriter;
java.io.IOException;
java.io.PrintStream;
java.io.Reader;
java.io.Writer;
java.util.ArrayList;

public class MyFile {


public static boolean exists(String uri) {
File file = new File(uri);
return file.exists();
}
public static void delete(String uri) {
File file = new File(uri);
file.delete();
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public static boolean write(String uri, String value) {
try {
FileWriter fw = new FileWriter(uri, true);
Throwable throwable = null;
try {
fw.write(value);
fw.flush();
boolean bl = true;
return bl;
}
catch (Throwable throwable2) {
throwable = throwable2;
throw throwable2;
}
finally {
if (fw != null) {
if (throwable != null) {
try {
fw.close();
}
catch (Throwable var5_7) {
throwable.addSuppressed(var5_7);
}

} else {
fw.close();
}
}
}
}
catch (IOException ioe) {
System.err.println("File write error");
return false;
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public static boolean write(String uri, String value, boolean append) {
try {
FileWriter fw = new FileWriter(uri, append);
Throwable throwable = null;
try {
fw.write(value);
fw.flush();
boolean bl = true;
return bl;
}
catch (Throwable throwable2) {
throwable = throwable2;
throw throwable2;
}
finally {
if (fw != null) {
if (throwable != null) {
try {
fw.close();
}
catch (Throwable var6_8) {
throwable.addSuppressed(var6_8);
}
} else {
fw.close();
}
}
}
}
catch (IOException ioe) {
System.err.println("File write error");
return false;
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation

*/
public static boolean bufferedWrite(String uri, String value) {
try {
BufferedWriter bw = new BufferedWriter(new FileWriter(uri, true));
Throwable throwable = null;
try {
bw.write(value);
bw.flush();
boolean bl = true;
return bl;
}
catch (Throwable throwable2) {
throwable = throwable2;
throw throwable2;
}
finally {
if (bw != null) {
if (throwable != null) {
try {
bw.close();
}
catch (Throwable var5_7) {
throwable.addSuppressed(var5_7);
}
} else {
bw.close();
}
}
}
}
catch (IOException ioe) {
System.err.println("File write error");
return false;
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public static boolean bufferedWrite(String uri, String value, boolean append) {
try {
BufferedWriter bw = new BufferedWriter(new FileWriter(uri, append));
Throwable throwable = null;
try {
bw.write(value);
bw.flush();
boolean bl = true;
return bl;
}
catch (Throwable throwable2) {
throwable = throwable2;
throw throwable2;
}
finally {

if (bw != null) {
if (throwable != null) {
try {
bw.close();
}
catch (Throwable var6_8) {
throwable.addSuppressed(var6_8);
}
} else {
bw.close();
}
}
}
}
catch (IOException ioe) {
System.err.println("File write error");
return false;
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public static boolean bufferedWriteLine(String uri, String value) {
try {
BufferedWriter bw = new BufferedWriter(new FileWriter(uri, true));
Throwable throwable = null;
try {
bw.write(value);
bw.newLine();
bw.flush();
boolean bl = true;
return bl;
}
catch (Throwable throwable2) {
throwable = throwable2;
throw throwable2;
}
finally {
if (bw != null) {
if (throwable != null) {
try {
bw.close();
}
catch (Throwable var5_7) {
throwable.addSuppressed(var5_7);
}
} else {
bw.close();
}
}
}
}
catch (IOException ioe) {

System.err.println("File write error");


return false;
}
}
/*
* Enabled aggressive block sorting
* Enabled unnecessary exception pruning
* Enabled aggressive exception aggregation
*/
public static boolean bufferedWriteLine(String uri, String value, boolean append) {
try {
BufferedWriter bw = new BufferedWriter(new FileWriter(uri, append));
Throwable throwable = null;
try {
bw.write(value);
bw.newLine();
bw.flush();
boolean bl = true;
return bl;
}
catch (Throwable throwable2) {
throwable = throwable2;
throw throwable2;
}
finally {
if (bw != null) {
if (throwable != null) {
try {
bw.close();
}
catch (Throwable var6_8) {
throwable.addSuppressed(var6_8);
}
} else {
bw.close();
}
}
}
}
catch (IOException ioe) {
System.err.println("File write error");
return false;
}
}
public static void readFile(String uri) {
try {
FileReader fr = new FileReader(uri);
char[] line = new char[1024];
try {
while (fr.read(line) != -1) {
System.out.println(String.copyValueOf(line));
}
fr.close();
}

catch (IOException ex) {


System.err.println("File read error!");
}
}
catch (FileNotFoundException fnfe) {
System.err.println("File not found");
}
}
public static void bufferedReadFile(String uri) {
try {
BufferedReader br = new BufferedReader(new FileReader(uri));
try {
String line = br.readLine();
while (line != null) {
System.out.println(line);
line = br.readLine();
}
br.close();
}
catch (IOException ioe) {
System.err.println("File read error");
}
}
catch (FileNotFoundException fnfe) {
System.err.println("File not found");
}
}
public static ArrayList<String> bufferedRead(String uri) {
ArrayList<String> records;
records = new ArrayList<String>();
try {
BufferedReader br = new BufferedReader(new FileReader(uri));
Throwable throwable = null;
try {
String line = br.readLine();
while (line != null) {
records.add(line);
line = br.readLine();
}
}
catch (Throwable line) {
throwable = line;
throw line;
}
finally {
if (br != null) {
if (throwable != null) {
try {
br.close();
}
catch (Throwable line) {
throwable.addSuppressed(line);
}
} else {

br.close();
}
}
}
}
catch (Exception e) {
System.err.println("File read error");
}
return records;
}
}

You might also like