Examples of FSDirectory

Unfortunately, because of system peculiarities, there is no single overall best implementation. Therefore, we've added the {@link #open} method, to allow Lucene to choosethe best FSDirectory implementation given your environment, and the known limitations of each implementation. For users who have no reason to prefer a specific implementation, it's best to simply use {@link #open}. For all others, you should instantiate the desired implementation directly.

The locking implementation is by default {@link NativeFSLockFactory}, but can be changed by passing in a custom {@link LockFactory} instance. @see Directory

  • org.apache.nutch.indexer.FsDirectory
    Reads a Lucene index stored in DFS.
  • org.jnode.fs.FSDirectory
    FSDirectory interface provide methods related to directory operations in a file system. @author epr

  • Examples of org.jnode.fs.FSDirectory

        public void testWriteFileThenRemountFSAndRead() throws Exception {
            setUp();

            final String fileName = "RWTest";

            FSDirectory rootDir = getFs().getRootEntry().getDirectory();
            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 {
                file = rootDir.addFile(fileName).getFile();
                file.write(0, data);
                file.flush();

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

            remountFS(config, config.isReadOnly());

            if (!config.isReadOnly()) {
                FSDirectory rootDir2 = getFs().getRootEntry().getDirectory();
                FSFile file2 = rootDir2.getEntry(fileName).getFile();
                assertNotNull("file not saved", file2);
                assertSize("bad file.length after remount", data.capacity(), file2.getLength());

                ByteBuffer data2 = ByteBuffer.allocate(data.capacity());
                log.debug(
    View Full Code Here

    Examples of org.jnode.fs.FSDirectory

                final String fileName = "RWTest";

                ByteBuffer data = ByteBuffer.wrap(addTestFile(fileName, FILE_SIZE_IN_WORDS));

                // re-get the entry to our test file
                FSDirectory rootDir2 = getFs().getRootEntry().getDirectory();
                FSFile file2 = rootDir2.getEntry(fileName).getFile();

                // In readOnly mode, writing to our file must fail
                try {
                    file2.write(0, data);
                    fail("write must throw ReadOnlyFileSystemException in readOnly mode");
    View Full Code Here

    Examples of org.jnode.fs.FSDirectory

            fs.create(params);
            fs.close();
            fs = new HfsPlusFileSystemType().create(device, false);
            fs.read();
            fs.createRootEntry();
            FSDirectory root = fs.getRootEntry().getDirectory();
            Assert.assertFalse("Must be empty", root.iterator().hasNext());
            root.addDirectory("test");
            fs.flush();
            fs.close();
            fs = new HfsPlusFileSystemType().create(device, false);
            fs.read();
            Assert.assertEquals(1, fs.getVolumeHeader().getFolderCount());
            fs.createRootEntry();
            root = fs.getRootEntry().getDirectory();
            Assert.assertTrue("Must contains one directory", root.iterator().hasNext());
        }
    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.