DojoFileStorageProviderpublic class DojoFileStorageProvider extends Object This is a simple class that can load, save, and remove
files from the native file system. It is needed by Safari and Opera
for the dojo.storage.browser.FileStorageProvider, since both of
these platforms have no native way to talk to the file system
for file:// URLs. Safari supports LiveConnect, but only for talking
to an applet, not for generic scripting by JavaScript, so we must
have an applet. |
Methods Summary |
---|
public java.lang.String | load(java.lang.String filePath)
StringBuffer results = new StringBuffer();
BufferedReader reader = new BufferedReader(
new FileReader(filePath));
String line = null;
while((line = reader.readLine()) != null){
results.append(line);
}
reader.close();
return results.toString();
| public void | remove(java.lang.String filePath)
File f = new File(filePath);
if(f.exists() == false || f.isDirectory()){
return;
}
if(f.exists() && f.isFile()){
f.delete();
}
| public void | save(java.lang.String filePath, java.lang.String content)
PrintWriter writer = new PrintWriter(
new BufferedWriter(
new FileWriter(filePath, false)));
writer.print(content);
writer.close();
|
|