Package org.jnode.fs

Examples of org.jnode.fs.FSDirectory


     */
    public final synchronized FSDirectory getDirectory(FSEntry entry) throws IOException {
        if (isClosed())
            throw new IOException("FileSystem is closed");

        FSDirectory dir = directories.get(entry);
        if (dir == null) {
            dir = createDirectory(entry);
            directories.put(entry, dir);
        }
        return dir;
View Full Code Here


                final String mountPath = "jnode";
                fSS.mount(mountPath, fs, null);
                log.info("Mounted " + type.getName() + " on " + mountPath);

                FSDirectory root_dir = fs.getRootEntry().getDirectory();
                root_dir.addDirectory("home");
                root_dir.addDirectory("tmp");
                // adding files to /jnode/lib/ required by thecore classes
                FSDirectory libDir = (FSDirectory) root_dir.addDirectory("lib");
                InputStream is = RAMFSPlugin.class.getResourceAsStream("flavormap.properties");
                if (is != null) {
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    byte[] buf = new byte[1024];
                    int c;
                    while ((c = is.read(buf)) > -1)
                        baos.write(buf, 0, c);

                    is.close();
                    baos.flush();
                    baos.close();

                    ByteBuffer data = ByteBuffer.wrap(baos.toByteArray());
                    FSFile fmp = (FSFile) libDir.addFile("flavormap.properties");
                    fmp.write(0, data);
                    fmp.flush();
                }
            } catch (DeviceAlreadyRegisteredException ex) {
                log.error("RAMFS is allready running.");
View Full Code Here

        }
        final String[] files = ds.getIncludedFiles();
        for (int i = 0; i < files.length; i++) {
            final String fn = files[i];
            final int idx = fn.lastIndexOf(File.separatorChar);
            final FSDirectory dir;
            final String name;
            if (idx >= 0) {
                dir = getOrCreateDir(fs, fn.substring(0, idx));
                name = fn.substring(idx + 1);
            } else {
View Full Code Here

    }

    private FSDirectory getOrCreateDir(FatFileSystem fs, String dirName)
        throws IOException {
        FSDirectory dir = fs.getRootDir();
        while (dirName.length() > 0) {
            final int idx = dirName.indexOf(File.separatorChar);
            final String part;
            if (idx >= 0) {
                part = dirName.substring(0, idx);
                dirName = dirName.substring(idx + 1);
            } else {
                part = dirName;
                dirName = "";
            }
            FSEntry entry;
            try {
                entry = dir.getEntry(part);
            } catch (IOException ex) {
                // Ignore
                entry = null;
            }
            if (entry == null) {
                entry = dir.addDirectory(part);
            }
            dir = entry.getDirectory();
        }
        return dir;
    }
View Full Code Here

TOP

Related Classes of org.jnode.fs.FSDirectory

Copyright © 2018 www.massapicom. 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.