@Override protected FileType doGetType() throws Exception { return data.getType(); }
@Override protected FileType doGetType() throws Exception { return data.getType(); }
@Override protected FileType doGetType() throws Exception { return data.getType(); }
@Override protected FileType doGetType() throws Exception { return data.getType(); }
/** * @param name The name of the file. * @return children The names of the children. */ String[] listChildren(final FileName name) { final RamFileData data = this.cache.get(name); if (data == null || !data.getType().hasChildren()) { return null; } final Collection<RamFileData> children = data.getChildren(); String[] names; synchronized (children) { names = new String[children.size()]; int pos = 0; final Iterator<RamFileData> iter = children.iterator(); while (iter.hasNext()) { final RamFileData childData = iter.next(); names[pos] = childData.getName().getBaseName(); pos++; } } return names; }
/** * @param name The name of the file. * @return children The names of the children. */ String[] listChildren(final FileName name) { final RamFileData data = this.cache.get(name); if (data == null || !data.getType().hasChildren()) { return null; } final Collection<RamFileData> children = data.getChildren(); String[] names; synchronized (children) { names = new String[children.size()]; int pos = 0; final Iterator<RamFileData> iter = children.iterator(); while (iter.hasNext()) { final RamFileData childData = iter.next(); names[pos] = childData.getName().getBaseName(); pos++; } } return names; }
/** * @param name The name of the file. * @return children The names of the children. */ String[] listChildren(final FileName name) { final RamFileData data = this.cache.get(name); if (data == null || !data.getType().hasChildren()) { return null; } final Collection<RamFileData> children = data.getChildren(); String[] names; synchronized (children) { names = new String[children.size()]; int pos = 0; final Iterator<RamFileData> iter = children.iterator(); while (iter.hasNext()) { final RamFileData childData = iter.next(); names[pos] = childData.getName().getBaseName(); pos++; } } return names; }
/** * Remove a child. * * @param data The file data. * @throws FileSystemException if an error occurs. */ void removeChild(final RamFileData data) throws FileSystemException { if (!this.getType().hasChildren()) { throw new FileSystemException("A child can only be removed from a folder"); } if (!this.children.contains(data)) { throw new FileSystemException("Child not found. " + data); } this.children.remove(data); updateLastModified(); }
/** * @param name The name of the file. * @return children The names of the children. */ String[] listChildren(final FileName name) { final RamFileData data = this.cache.get(name); if (data == null || !data.getType().hasChildren()) { return null; } final Collection<RamFileData> children = data.getChildren(); String[] names; synchronized (children) { names = new String[children.size()]; int pos = 0; final Iterator<RamFileData> iter = children.iterator(); while (iter.hasNext()) { final RamFileData childData = iter.next(); names[pos] = childData.getName().getBaseName(); pos++; } } return names; }
/** * Remove a child. * * @param data The file data. * @throws FileSystemException if an error occurs. */ void removeChild(final RamFileData data) throws FileSystemException { if (!this.getType().hasChildren()) { throw new FileSystemException("A child can only be removed from a folder"); } if (!this.children.contains(data)) { throw new FileSystemException("Child not found. " + data); } this.children.remove(data); updateLastModified(); }
/** * Remove a child. * * @param data The file data. * @throws FileSystemException if an error occurs. */ void removeChild(final RamFileData data) throws FileSystemException { if (!this.getType().hasChildren()) { throw new FileSystemException("A child can only be removed from a folder"); } if (!this.children.contains(data)) { throw new FileSystemException("Child not found. " + data); } this.children.remove(data); updateLastModified(); }
/** * Remove a child. * * @param data The file data. * @throws FileSystemException if an error occurs. */ void removeChild(final RamFileData data) throws FileSystemException { if (!this.getType().hasChildren()) { throw new FileSystemException( "A child can only be removed from a folder"); } if (!this.children.contains(data)) { throw new FileSystemException("Child not found. " + data); } this.children.remove(data); updateLastModified(); }
/** * Add a child. * * @param data The file data. * @throws FileSystemException if an error occurs. */ void addChild(final RamFileData data) throws FileSystemException { if (!this.getType().hasChildren()) { throw new FileSystemException("A child can only be added in a folder"); } FileSystemException.requireNonNull(data, "No child can be null"); if (this.children.contains(data)) { throw new FileSystemException("Child already exists. " + data); } this.children.add(data); updateLastModified(); }
/** * Add a child. * * @param data The file data. * @throws FileSystemException if an error occurs. */ void addChild(final RamFileData data) throws FileSystemException { if (!this.getType().hasChildren()) { throw new FileSystemException("A child can only be added in a folder"); } if (data == null) { throw new FileSystemException("No child can be null"); } if (this.children.contains(data)) { throw new FileSystemException("Child already exists. " + data); } this.children.add(data); updateLastModified(); }
/** * Add a child. * * @param data The file data. * @throws FileSystemException if an error occurs. */ void addChild(final RamFileData data) throws FileSystemException { if (!this.getType().hasChildren()) { throw new FileSystemException("A child can only be added in a folder"); } if (data == null) { throw new FileSystemException("No child can be null"); } if (this.children.contains(data)) { throw new FileSystemException("Child already exists. " + data); } this.children.add(data); updateLastModified(); }
/** * Add a child. * * @param data The file data. * @throws FileSystemException if an error occurs. */ void addChild(final RamFileData data) throws FileSystemException { if (!this.getType().hasChildren()) { throw new FileSystemException( "A child can only be added in a folder"); } if (data == null) { throw new FileSystemException("No child can be null"); } if (this.children.contains(data)) { throw new FileSystemException("Child already exists. " + data); } this.children.add(data); updateLastModified(); }
/** * @param from The original file. * @param to The new file. * @throws FileSystemException if an error occurs. */ void rename(final RamFileObject from, final RamFileObject to) throws FileSystemException { if (!this.cache.containsKey(from.getName())) { throw new FileSystemException("File does not exist: " + from.getName()); } // Copy data to.getData().setContent(from.getData().getContent()); to.getData().setLastModified(from.getData().getLastModified()); to.getData().setType(from.getData().getType()); this.save(to); this.delete(from); }
/** * @param from The original file. * @param to The new file. * @throws FileSystemException if an error occurs. */ void rename(final RamFileObject from, final RamFileObject to) throws FileSystemException { if (!this.cache.containsKey(from.getName())) { throw new FileSystemException("File does not exist: " + from.getName()); } // Copy data to.getData().setContent(from.getData().getContent()); to.getData().setLastModified(from.getData().getLastModified()); to.getData().setType(from.getData().getType()); this.save(to); this.delete(from); }
/** * @param from The original file. * @param to The new file. * @throws FileSystemException if an error occurs. */ void rename(final RamFileObject from, final RamFileObject to) throws FileSystemException { if (!this.cache.containsKey(from.getName())) { throw new FileSystemException("File does not exist: " + from.getName()); } // Copy data to.getData().setContent(from.getData().getContent()); to.getData().setLastModified(from.getData().getLastModified()); to.getData().setType(from.getData().getType()); this.save(to); this.delete(from); }
/** * @param from The original file. * @param to The new file. * @throws FileSystemException if an error occurs. */ void rename(final RamFileObject from, final RamFileObject to) throws FileSystemException { if (!this.cache.containsKey(from.getName())) { throw new FileSystemException("File does not exist: " + from.getName()); } // Copy data to.getData().setContent(from.getData().getContent()); to.getData().setLastModified(from.getData().getLastModified()); to.getData().setType(from.getData().getType()); this.save(to); this.delete(from); }