DataStore now works

This commit is contained in:
Grant Limberg 2015-05-02 18:22:56 -07:00
parent a9307693a6
commit ad6ec22857
2 changed files with 23 additions and 7 deletions

View file

@ -16,20 +16,28 @@ public class JavaFileProvider implements DataStoreFileProvider {
@Override
public FileInputStream getInputFileStream(String name)
throws FileNotFoundException {
File f = new File(_path + File.pathSeparator + name);
File f = new File(_path + File.separator + name);
return new FileInputStream(f);
}
@Override
public FileOutputStream getOutputFileStream(String name)
throws FileNotFoundException {
File f = new File(_path + File.pathSeparator + name);
File f = new File(_path + File.separator + name);
if(!f.exists())
{
try {
f.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
return new FileOutputStream(f);
}
@Override
public void deleteFile(String name) throws IOException {
File f = new File(_path + File.pathSeparator + name);
File f = new File(_path + File.separator + name);
boolean success = f.delete();
if(!success) {
throw new IOException("Unable to delete file: " + _path + File.pathSeparator + name);