Package org.jnode.fs

Examples of org.jnode.fs.FSDirectory.addFile()


        FSFile file = null;
        ByteBuffer data = ByteBuffer.wrap(TestUtils.getTestData(FILE_SIZE_IN_WORDS));

        if (config.isReadOnly()) {
            try {
                file = rootDir.addFile(fileName).getFile();
                fail("addFile must throw ReadOnlyFileSystemException in readOnly mode");
            } catch (ReadOnlyFileSystemException rofse) {
                // success
            }
        } else {
View Full Code Here


                fail("addFile must throw ReadOnlyFileSystemException in readOnly mode");
            } catch (ReadOnlyFileSystemException rofse) {
                // success
            }
        } else {
            file = rootDir.addFile(fileName).getFile();
            file.write(0, data);
            file.flush();

            assertSize("bad file.length after write", data.capacity(), file.getLength());
        }
View Full Code Here

                    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);
View Full Code Here

        }
        FSDirectory directory = getParentDirectoryEntry(file);
        if (directory == null)
            return false;
        // Ok, make the file
        entry = directory.addFile(getName(file));
        return true;
    }

    /**
     * Mount the given filesystem at the fullPath, using the fsPath as root of
View Full Code Here

        final FSFile fh1 = dir.addFile("test.lst").getFile();
        fh1.setLength(urlConn.getContentLength());
        fh1.write(0, buf);

        final FSFile fh2 = bgDir.addFile("menu.lst").getFile();
        fh2.setLength(urlConn.getContentLength());
        fh2.write(0, buf);

        fs.flush();
View Full Code Here

        log.debug("Root dir before testAddFile :");
        TestUtils.listEntries(rootDir.iterator());
        if (config.isReadOnly()) {
            try {
                rootDir.addFile(fileName);
                fail("addFile must fail in readOnly mode");
            } catch (ReadOnlyFileSystemException e) {
                // success
            }
View Full Code Here

            }

            assertContainsOnly("must be empty", rootDir.iterator(), getEmptyDirNames(config, true));
        } else {
            try {
                FSEntry entry = rootDir.addFile(fileName);
                // success
                log.debug("added file entry=" + FSUtils.toString(entry, true));
            } catch (ReadOnlyFileSystemException e) {
                fail("addFile must succeed in read/write mode");
            }
View Full Code Here

        if (!config.isReadOnly()) {
            setUp();

            String filename = "a file to test.text";
            FSDirectory rootDir = getFs().getRootEntry().getDirectory();
            FSEntry entry = rootDir.addFile(filename);
            FSEntry gotEntry = rootDir.getEntry(filename);
            assertNotNull("must contain the added file", gotEntry);
            assertEquals("returned bad entry", filename, gotEntry.getName());

            log.debug("entry before remount=" + FSUtils.toString(entry, true));
View Full Code Here

            setUp();

            String filename = "a file to test.text";
            FSDirectory rootDir = getFs().getRootEntry().getDirectory();
            /*FSEntry entry =*/
            rootDir.addFile(filename);
            FSEntry gotEntry = rootDir.getEntry(filename);
            assertNotNull("must contain the added file", gotEntry);
            assertEquals("returned bad entry", filename, gotEntry.getName());

            rootDir.remove(filename);
View Full Code Here

        // remount FS in write mode, and write some data to our test file
        remountFS(config, false); // false = read/write mode

        FSDirectory rootDir = fs.getRootEntry().getDirectory();
        ByteBuffer data = ByteBuffer.wrap(TestUtils.getTestData(fileSizeInWords));
        FSFile file = rootDir.addFile(fileName).getFile();
        file.write(0, data);
        file.flush();

        // remount FS in readOnly mode
        remountFS(config, oldReadOnly);
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.