Java Reference
In-Depth Information
L ISTING D.9 Continued
*/
public PersistenceServiceImpl() {
try {
if (!sysDir.exists())
sysDir.mkdir();
} catch (Exception ex) {
System.out.println(“PersistenceServiceImpl() creating support directory:
“+ex);
}
}
/**
* Creates a new persistent storage entry on the client side named with the
given URL
*/
public long create(URL urlKey, long param) throws
java.net.MalformedURLException, java.io.IOException {
File f = new File(sysDir, transformURL(urlKey));
File parent = f.getParentFile();
parent.mkdirs();
f.createNewFile();
//ignore param;
return param;
}
/**
* Removes the stream associated with the given
URL from the client-side date persistence store.
*/
public void delete(URL urlKey) throws java.net.MalformedURLException,
java.io.IOException {
File f = new File(sysDir, transformURL(urlKey));
f.delete();
D
}
/**
* Returns a FileContents object representing the contents of this file.
*/
public FileContents get(URL urlKey) throws java.net.MalformedURLException,
java.io.IOException, java.io.FileNotFoundException {
return new FileContentsImpl(new File(sysDir, transformURL(urlKey)));
}
/**
Search WWH ::




Custom Search