public boolean exists() {
   try {
     return LocalStorage.getItem(getCanonicalPath()) != null;
   } catch (IOException e) {
     return false;
   }
 }
 public boolean isFile() {
   try {
     String s = LocalStorage.getItem(getCanonicalPath());
     return s != null && !s.startsWith("{");
   } catch (IOException e) {
     return false;
   }
 }
 public boolean delete() {
   try {
     if (!exists()) {
       return false;
     }
     LocalStorage.removeItem(getCanonicalPath());
     return true;
   } catch (IOException e) {
     return false;
   }
 }
 public boolean mkdir() {
   try {
     if (parent != null && !parent.exists()) {
       return false;
     }
     if (exists()) {
       return false;
     }
     // We may want to make this a JS map
     LocalStorage.setItem(getCanonicalPath(), "{}");
     return true;
   } catch (IOException e) {
     return false;
   }
 }
  public File[] listFiles(FilenameFilter filter) {
    ArrayList<File> files = new ArrayList<File>();
    try {
      String prefix = getCanonicalPath();
      if (!prefix.endsWith(separator)) {
        prefix += separatorChar;
      }

      int cut = prefix.length();
      int cnt = LocalStorage.length();
      for (int i = 0; i < cnt; i++) {
        String key = LocalStorage.key(i);
        if (key.startsWith(prefix) && key.indexOf(separatorChar, cut) == -1) {
          String name = key.substring(cut);
          if (filter == null || filter.accept(this, name)) {
            files.add(new File(this, name));
          }
        }
      }
    } catch (IOException e) {
      System.err.println("lisFiles() exception: " + e);
    }
    return files.toArray(new File[files.size()]);
  }
 public boolean createNewFile() throws IOException {
   if (exists()) return false;
   if (!parent.exists()) return false;
   LocalStorage.setItem(getCanonicalPath(), RandomAccessFile.btoa(""));
   return true;
 }