Examples of FSEntry


Examples of org.jnode.fs.FSEntry

            setUp();

            FSDirectory rootDir = getFs().getRootEntry().getDirectory();
            log.debug("### testFSTreeWithRemount: rootDir=\n" + FSUtils.toString(rootDir, true));

            FSEntry dir1 = rootDir.addDirectory(fileName);
            assertNotNull("'" + fileName + "' not added", rootDir.getEntry(fileName));

            log.debug("### testFSTreeWithRemount: before remountFS");
            remountFS(config, getFs().isReadOnly());
            log.debug("### testFSTreeWithRemount: after remountFS");

            FSDirectory gotRootDir = getFs().getRootEntry().getDirectory();
            assertNotNull("rootDir not saved", gotRootDir);
            assertFalse("same ref (gotRootDir) after remount", gotRootDir == rootDir);
            log.debug("### testFSTreeWithRemount: gotRootDir=\n" + FSUtils.toString(gotRootDir, true));

            FSEntry gotDir1 = gotRootDir.getEntry(fileName);
            log.debug("### testFSTreeWithRemount: after gotRootDir.getEntry");
            assertNotNull("'" + fileName + "' not saved", gotDir1);
            assertFalse("same ref (gotDir1) after remount", gotDir1 == dir1);
            assertEquals("returned bad entry", dir1.getName(), gotDir1.getName());
        }
    }
View Full Code Here

Examples of org.jnode.fs.FSEntry

        actual.append(String.format("type: %s vol:%s total:%d free:%d\n",
            fileSystem.getType().getName(), fileSystem.getVolumeName(),
            fileSystem.getTotalSpace(), fileSystem.getFreeSpace()));

        FSEntry entry = fileSystem.getRootEntry();
        buildStructure(entry, actual, "  ");

        Assert.assertEquals("Wrong structure", expected, actual.toString());
    }
View Full Code Here

Examples of org.jnode.fs.FSEntry

            FSDirectory directory = entry.getDirectory();
            Iterator<? extends FSEntry> iterator = directory.iterator();

            while (iterator.hasNext()) {
                FSEntry child = iterator.next();

                if (".".equals(child.getName()) || "..".equals(child.getName())) {
                    continue;
                }

                buildStructure(child, actual, indent + "  ");
            }
View Full Code Here

Examples of org.jnode.fs.FSEntry

     * Gets a cached entry for a given path.
     *
     * @param path must be an absolute path
     */
    public synchronized FSEntry getEntry(String path) {
        final FSEntry entry = entries.get(path);
        if (entry != null) {
            if (entry.isValid()) {
                return entry;
            } else {
                entries.remove(path);
                return null;
            }
View Full Code Here

Examples of org.jnode.fs.FSEntry


    }

    public String[] list(File directory, FilenameFilter filter) throws IOException {
        final FSEntry entry = NTFSfs.getRootEntry();
        if (entry == null) {
            throw new FileNotFoundException(directory.getAbsolutePath());
        }
        if (!entry.isDirectory()) {
            throw new IOException("Cannot list on non-directories " + directory);
        }
        final ArrayList<String> list = new ArrayList<String>();
        for (Iterator<? extends FSEntry> i = entry.getDirectory().iterator(); i.hasNext();) {
            final FSEntry child = i.next();
            final String name = child.getName();
            if ((filter == null) || (filter.accept(directory, name))) {
                list.add(name);
            }
            if (child.isDirectory())
                child.getDirectory();
            else
                child.getFile();

            if (child.isFile())
                System.out.println(
                    "Name = \"" + name + "\" , Size = " + child.getFile().getLength() + ", IsDirectory = " +
                        child.isDirectory());
            else
                System.out.println(
                    "Name = \"" + name + "\" , IsDirectory = " + child.isDirectory());
        }

        return list.toArray(new String[list.size()]);
    }
View Full Code Here

Examples of org.jnode.fs.FSEntry

    public void iterateRoot(FSDirectory root) {
        try {
            Iterator<? extends FSEntry> rootIterator;
            rootIterator = root.iterator();
            while (rootIterator.hasNext()) {
                FSEntry entry = rootIterator.next();
                System.out.println(entry.getName());
            }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
View Full Code Here

Examples of org.jnode.fs.FSEntry

        this.name = name;
        this.parent = parent.getDirectory();
        if ((path == null) || (path.length() == 0)) {
            this.root = mountedFS.getRootEntry();
        } else {
            FSEntry e = mountedFS.getRootEntry();
            while (path != null) {
                final int idx = path.indexOf(File.separatorChar);
                final String dir;
                if (idx > 0) {
                    dir = path.substring(0, idx);
                    path = path.substring(idx + 1);
                } else {
                    dir = path;
                    path = null;
                }
                e = e.getDirectory().getEntry(dir);
            }
            this.root = e;
        }
    }
View Full Code Here

Examples of org.jnode.fs.FSEntry

    protected FSEntryTable readEntries() throws IOException {
        Ext2FSEntryIterator it = new Ext2FSEntryIterator(entry);
        ArrayList<FSEntry> entries = new ArrayList<FSEntry>();

        while (it.hasNext()) {
            final FSEntry entry = it.next();
            log.debug("readEntries: entry=" + FSUtils.toString(entry, false));
            entries.add(entry);
        }

        FSEntryTable table = new FSEntryTable((AbstractFileSystem<?>) getFileSystem(), entries);
View Full Code Here

Examples of org.jnode.fs.FSEntry

    public final void printTo(PrintWriter out) {
        checkEntriesLoaded();
        int freeCount = 0;
        int size = entries.size();
        for (int i = 0; i < size; i++) {
            FSEntry entry = entries.get(i);
            if (entry != null) {
                out.println("0x" + Integer.toHexString(i) + " " + entry);
            } else {
                freeCount++;
            }
View Full Code Here

Examples of org.jnode.fs.FSEntry

            throw new ReadOnlyFileSystemException("Filesystem or directory is mounted read-only!");

        if (getEntry(name) != null) {
            throw new IOException("File or Directory already exists" + name);
        }
        FSEntry newEntry = createDirectoryEntry(name);
        setFreeEntry(newEntry);
        log.debug("<<< END addDirectory " + name + " >>>");
        return newEntry;
    }
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.