public java.util.Date lastModified(String name) { java.util.Date d = e (name).last; return d == null ? created : d; }
public long size(String name) { byte[] d = e (name).data; return d == null ? 0 : d.length; }
public java.util.Date lastModified(String name) { java.util.Date d = e (name).last; return d == null ? created : d; }
public boolean folder(String name) { return e (name).data == null; }
public long size(String name) { byte[] d = e (name).data; return d == null ? 0 : d.length; }
public InputStream inputStream(String name) throws java.io.FileNotFoundException { byte[] arr = e (name).data; if (arr == null) { arr = new byte[0]; } return new ByteArrayInputStream (arr); }
public void writeAttribute(String name, String attrName, Object value) throws IOException { e (name).attrs.put (attrName, value); } }
public void writeAttribute(String name, String attrName, Object value) throws IOException { e (name).attrs.put (attrName, value); } }
public InputStream inputStream(String name) throws java.io.FileNotFoundException { byte[] arr = e (name).data; if (arr == null) { arr = new byte[0]; } return new ByteArrayInputStream (arr); }
public String mimeType(String name) { return (String)e (name).attrs.get ("mimeType"); }
/** Creates MemoryFS with data */ public MemoryFileSystem(String[] resources) { this (); StringBuffer sb = new StringBuffer (); for (int i = 0; i < resources.length; i++) { sb.append (resources[i]); if (resources[i].endsWith("/")) { // folder e (resources[i]).data = null; } else { e (resources[i]).data = new byte[0]; } } }
public void createFolder(String name) throws java.io.IOException { if (is(name)) throw new IOException("File already exists"); e (name).data = null; }
public void createData(String name) throws IOException { if (is(name)) throw new IOException("File already exists"); e (name).data = new byte[0]; }
public void createFolder(String name) throws java.io.IOException { if (is(name)) throw new IOException("File already exists"); e (name).data = null; }
public Object readAttribute(String name, String attrName) { return is (name) ? e (name).attrs.get (attrName) : null; }
public Object readAttribute(String name, String attrName) { return is (name) ? e (name).attrs.get (attrName) : null; }
public void createData(String name) throws IOException { if (is(name)) throw new IOException("File already exists"); e (name).data = new byte[0]; }
public void rename(String oldName, String newName) throws IOException { if (! is(oldName)) throw new IOException("The file to rename does not exist."); if (is(newName)) throw new IOException("Cannot rename to existing file"); if (newName.length () > 0 && newName.charAt(0) == '/') newName = newName.substring (1); Entry e = e (oldName); entries.remove(oldName); entries.put (newName, e); }
public void rename(String oldName, String newName) throws IOException { if (! is(oldName)) throw new IOException("The file to rename does not exist."); if (is(newName)) throw new IOException("Cannot rename to existing file"); if (newName.length () > 0 && newName.charAt(0) == '/') newName = newName.substring (1); Entry e = e (oldName); entries.remove(oldName); entries.put (newName, e); }
public Enumeration attributes(String name) { return is (name) ? Collections.enumeration (e (name).attrs.keySet ()) : org.openide.util.Enumerations.empty(); }