|
@ -1,6 +1,5 @@ |
|
|
import java.io.BufferedWriter; |
|
|
|
|
|
import java.io.FileWriter; |
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
|
import java.io.*; |
|
|
|
|
|
import java.util.Scanner; |
|
|
|
|
|
|
|
|
public class Storage implements StorageInterface { |
|
|
public class Storage implements StorageInterface { |
|
|
@Override |
|
|
@Override |
|
@ -28,4 +27,24 @@ public class Storage implements StorageInterface { |
|
|
} |
|
|
} |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String readFile(String path) { |
|
|
|
|
|
if (!path.isEmpty()) { |
|
|
|
|
|
StringBuilder data = new StringBuilder(); |
|
|
|
|
|
try { |
|
|
|
|
|
File f = new File(path); |
|
|
|
|
|
Scanner myReader = new Scanner(f); |
|
|
|
|
|
while (myReader.hasNextLine()) { |
|
|
|
|
|
data.append(myReader.nextLine()); |
|
|
|
|
|
} |
|
|
|
|
|
myReader.close(); |
|
|
|
|
|
} catch (FileNotFoundException e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return data.toString(); |
|
|
|
|
|
} |
|
|
|
|
|
return null; |
|
|
|
|
|
} |
|
|
} |
|
|
} |