Package org.apache.commons.vfs

Examples of org.apache.commons.vfs.FileObject.createFile()


        assertFalse(file.getParent().isHidden());
        assertFalse(file.getParent().getParent().isHidden());
       
        // Test creating a file that already exists
        assertTrue(file.exists());
        file.createFile();
        assertTrue(file.exists());
        assertTrue(file.isReadable());
        assertTrue(file.isWriteable());
    }
View Full Code Here


    {
        FileObject scratchFolder = createScratchFolder();

        // Create a test file and folder
        FileObject file = scratchFolder.resolveFile("dir1/file1.txt");
        file.createFile();
        assertEquals(FileType.FILE, file.getType());

        FileObject folder = scratchFolder.resolveFile("dir1/dir2");
        folder.createFolder();
        assertEquals(FileType.FOLDER, folder.getType());
View Full Code Here

        assertEquals(FileType.FOLDER, folder.getType());

        // Attempt to create a file that already exists as a folder
        try
        {
            folder.createFile();
            fail();
        }
        catch (FileSystemException exc)
        {
        }
View Full Code Here

        // Delete again.  Should not get an event
        child.delete();

        // Create as a file
        listener.addCreateEvent();
        child.createFile();
        listener.assertFinished();

        // Create the file again.  Should not get an event
        child.createFile();
View Full Code Here

        listener.addCreateEvent();
        child.createFile();
        listener.assertFinished();

        // Create the file again.  Should not get an event
        child.createFile();

        listener.addDeleteEvent();
        child.delete();

        // Create as a file, by writing to it.
View Full Code Here

        scratchFolder.createFolder();

        final FileObject dir1 = scratchFolder.resolveFile("dir1");
        dir1.createFolder();
        final FileObject dir1file1 = dir1.resolveFile("a.txt");
        dir1file1.createFile();
        final FileObject dir2 = scratchFolder.resolveFile("dir2");
        dir2.createFolder();
        final FileObject dir2file1 = dir2.resolveFile("b.txt");
        dir2file1.createFile();
View Full Code Here

        final FileObject dir1file1 = dir1.resolveFile("a.txt");
        dir1file1.createFile();
        final FileObject dir2 = scratchFolder.resolveFile("dir2");
        dir2.createFolder();
        final FileObject dir2file1 = dir2.resolveFile("b.txt");
        dir2file1.createFile();

        return scratchFolder;
    }

    /**
 
View Full Code Here

            throw new Exception("USAGE: touch <path>");
        }
        final FileObject file = mgr.resolveFile(cwd, cmd[1]);
        if (!file.exists())
        {
            file.createFile();
        }
        file.getContent().setLastModifiedTime(System.currentTimeMillis());
    }

    /**
 
View Full Code Here

        // create a new fileNew and delete it again
        fo3 = fsManager.resolveFile(relativeToFO, dummyFileDirName);
        if (!fo3.exists()) {
            System.out.println("Creating File: " + dummyFileDirName);
            fo3.createFile();
            assertTrue(fo3.exists());// assert that it now exists
            assertTrue(fo3.getType() == FileType.FILE);
            System.out.println("File exists and is of type FILE, now deleting");
            fo3.delete();// now delete the fileNew
            assertFalse(fo3.exists());// assert that it now dont exist
View Full Code Here

            System.out.println("sizepre: " + sizepre);

            newFile = relativeToFOSrc.resolveFile(dummyFileDirName);

            System.out.println("Creating new file");
            newFile.createFile();

            //relativeToFOSrc.refresh();
            System.out.println("Getting a list of children");
            kidspre = relativeToFOSrc.getChildren();
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.