Examples of FSEntry


Examples of org.jnode.fs.FSEntry

     * Gets the last modification date of the given file.
     *
     * @param file
     */
    public long getLastModified(String file) {
        final FSEntry entry = getEntry(file);
        if (entry != null) {
            try {
                return entry.getLastModified();
            } catch (IOException ex) {
                return 0;
            }
        } else {
            return 0;
View Full Code Here

Examples of org.jnode.fs.FSEntry

     * Sets the last modification date of the given file.
     *
     * @param file
     */
    public void setLastModified(String file, long time) throws IOException {
        final FSEntry entry = getEntry(file);
        if (entry != null) {
            entry.setLastModified(time);
        } else {
            throw new FileNotFoundException(file);
        }
    }
View Full Code Here

Examples of org.jnode.fs.FSEntry

     * are relative to the given directory.
     *
     * @param directory
     */
    public String[] list(String directory) throws IOException {
        final FSEntry entry = getEntry(directory);
        if (entry == null) {
            throw new FileNotFoundException(directory);
        }
        if (!entry.isDirectory()) {
            throw new IOException("Cannot list on non-directories " + directory);
        }

        final ArrayList<String> list = new ArrayList<String>();
        final StringBuilder entryPath = new StringBuilder(directory).append(File.separatorChar);
        final int directoryPathSize = entryPath.length();

        for (Iterator<? extends FSEntry> i = entry.getDirectory().iterator(); i.hasNext();) {
            final FSEntry child = i.next();
            final String name = child.getName();

            // never include the parent directory and the current directory in
            // the result if they exist by any chance.
            if (".".equals(name) || "..".equals(name)) {
                continue;
View Full Code Here

Examples of org.jnode.fs.FSEntry

        }
        return list.toArray(new String[list.size()]);
    }

    private FSAccessRights getAccessRights(String path) throws IOException {
        FSEntry entry = getEntry(path);
        if (entry == null)
            throw new FileNotFoundException("file not found: " + path);

        try {
            return entry.getAccessRights();
        } catch (UnsupportedOperationException e) {
            // todo review
            // this feature is not implemented yet in al file system
            // implementations
            // return null in those cases
View Full Code Here

Examples of org.jnode.fs.FSEntry

            if (path.length() == 0) {
                return vfs.getRootEntry();
            }

            FSEntry entry = entryCache.getEntry(path);
            if (entry != null) {
                return entry;
            }
            final FSDirectory parentEntry = getParentDirectoryEntry(path);
            if (parentEntry != null) {
View Full Code Here

Examples of org.jnode.fs.FSEntry

     *
     * @param file absolute path
     * @throws IOException
     */
    public VMFileHandle open(String file, VMOpenMode mode) throws IOException {
        FSEntry entry = getEntry(file);
        if ((entry != null) && !entry.isFile()) {
            throw new IOException("Not a file " + file);
        }
        if (entry == null) {
            if (mode.canWrite()) {
                // Try to create the file
                FSDirectory parent = getParentDirectoryEntry(file);
                if (parent == null) {
                    throw new IOException("Cannot create " + file +
                            ", parent directory does not exist");
                }

                // Ok, add the file
                entry = parent.addFile(getName(file));
            } else {
                throw new FileNotFoundException(file);
            }
        }
        return fhm.open(entry.getFile(), mode);
        // TODO open need not create the file but throw FileNotFoundException
    }
View Full Code Here

Examples of org.jnode.fs.FSEntry

     *
     * @param file
     * @throws IOException
     */
    public boolean mkDir(String file) throws IOException {
        FSEntry entry = getEntry(file);
        if (entry != null) {
            log.debug(file + "exists");
            return false;
        }
        FSDirectory directory = getParentDirectoryEntry(file);
View Full Code Here

Examples of org.jnode.fs.FSEntry

     *
     * @param file
     * @throws IOException
     */
    public boolean mkFile(String file, VMOpenMode mode) throws IOException {
        FSEntry entry = getEntry(file);
        if ((entry != null) || !mode.canWrite()) {
            return false;
        }
        FSDirectory directory = getParentDirectoryEntry(file);
        if (directory == null)
View Full Code Here

Examples of org.jnode.fs.FSEntry

     * @param fsPath Null or empty to use the root of the filesystem.
     */
    void mount(String fullPath, FileSystem<?> fs, String fsPath) throws IOException {
        final String dir = getParentPath(fullPath);
        final String name = stripParentPath(fullPath);
        final FSEntry entry = getEntry(dir);
        if (entry == null) {
            throw new FileNotFoundException(dir);
        }
        if (!(entry instanceof VirtualDirEntry)) {
            throw new IOException("Cannot mount at " + dir);
View Full Code Here

Examples of org.jnode.fs.FSEntry

     *
     * @param fullPath
     * @return
     */
    boolean isMount(String fullPath) {
        final FSEntry entry = getEntry(fullPath);
        return (entry instanceof VirtualMountEntry);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.