Package org.apache.commons.vfs

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


        System.out.println("children in new empty folder : " + children.length);
        assertEquals(children.length, 0);

        // create a new file within the folder
        FileObject newFile = newFolder.resolveFile(dummyFileDirName);
        newFile.createFile();

        // assert file is NOT present in the cached list of children
        //System.out.println("cached children in new folder : "+children.length);
        //assertEquals(children.length, 0);
View Full Code Here


            }


            // first create an IMAGINARY 'place holder' file on the target  (could give new name here)
            dummyDataFileCopy = relativeToFODest.resolveFile(dummyFileDirName);
            dummyDataFileCopy.createFile();
            // and copy the source data to the target file
            VFSUtil.copy(dummyDataFileSrc, dummyDataFileCopy, new MarkerListenerImpl(),  doThirdPartyTransferForTwoGridFtpFileObjects);
            // test content is identical
            assertEquals(FileType.FILE, dummyDataFileCopy.getType());
            if (assertContent) {
View Full Code Here

        FileObject fileNew = null;
        OutputStream os = null;
        try {
            fileNew = relativeToFO.resolveFile(fileName);
            if (!fileNew.exists()) {
                fileNew.createFile();
                // write some text to the fileNew.
                byte[] bytes = content.getBytes("utf-8");
                os = fileNew.getContent().getOutputStream();
                os.write(bytes);
            }
View Full Code Here

        for(int i = 0; i < 10; i++)
        {
            FileObject file = unitTestFolder.resolveFile("TestFile" + i + ".txt");
            if(!file.exists())
            {
                file.createFile();

                String content = "";

                while(content.length() < TEN_MB)
                {
View Full Code Here

                FileObject obj = fileObject.resolveFile(name);
                obj.createFolder();
                return new VFSNodeImpl(obj, session);
            } else if (type.equals(Constants.NT_FILE) || type.equals(Constants.JAHIANT_FILE)) {
                FileObject obj = fileObject.resolveFile(name);
                obj.createFile();
                return new VFSNodeImpl(obj, session);
            } else if (type.equals(Constants.NT_RESOURCE)) {
                //
            }
        } catch (FileSystemException e) {
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

        try {
            FileObject[] kidspre = relativeToFOSrc.getChildren();
            int sizepre = kidspre.length;

            newFile = relativeToFOSrc.resolveFile(dummyFileDirName);
            newFile.createFile();

            //relativeToFOSrc.refresh();
            kidspre = relativeToFOSrc.getChildren();

            int sizepost = kidspre.length;
View Full Code Here

        System.out.println("children in new empty folder : " + children.length);
        assertEquals(children.length, 0);

        // create a new file within the folder
        FileObject newFile = newFolder.resolveFile(dummyFileDirName);
        newFile.createFile();

        // assert file is NOT present in the cached list of children
        //System.out.println("cached children in new folder : "+children.length);
        //assertEquals(children.length, 0);
View Full Code Here

            }


            // first create an IMAGINARY 'place holder' file on the target  (could give new name here)
            dummyDataFileCopy = relativeToFODest.resolveFile(dummyFileDirName);
            dummyDataFileCopy.createFile();
            // and copy the source data to the target file
            VFSUtil.copy(dummyDataFileSrc, dummyDataFileCopy, new MarkerListenerImpl(),  doThirdPartyTransferForTwoGridFtpFileObjects);
            // test content is identical
            assertEquals(FileType.FILE, dummyDataFileCopy.getType());
            if (assertContent) {
View Full Code Here

        FileObject fileNew = null;
        OutputStream os = null;
        try {
            fileNew = relativeToFO.resolveFile(fileName);
            if (!fileNew.exists()) {
                fileNew.createFile();
                // write some text to the fileNew.
                byte[] bytes = content.getBytes("utf-8");
                os = fileNew.getContent().getOutputStream();
                os.write(bytes);
            }
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.