Package org.apache.commons.vfs

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


        final String basename = srcFile.getName().getBaseName();
        final File file = allocateFile(basename);

        // Copy from the source file
        final FileObject destFile = getContext().toFileObject(file);
        destFile.copyFrom(srcFile, selector);

        return file;
    }
}
View Full Code Here


        assertSameContent(content, file);

        // Make sure we can copy the new file to another file on the same filesystem
        FileObject fileCopy = scratchFolder.resolveFile("file1copy.txt");
        assertTrue(!fileCopy.exists());
        fileCopy.copyFrom(file, Selectors.SELECT_SELF);

        assertSameContent(content, fileCopy);
    }

    /**
 
View Full Code Here

        assertSameContent(content, file);

        // Make sure we can copy the new file to another file on the same filesystem
        FileObject fileCopy = scratchFolder.resolveFile("file1copy.txt");
        assertTrue(!fileCopy.exists());
        fileCopy.copyFrom(file, Selectors.SELECT_SELF);

        assertSameContent(content, fileCopy);
       
        // Make sure we can copy the same new file to the same target file on the same filesystem
        assertTrue(fileCopy.exists());
View Full Code Here

        assertSameContent(content, fileCopy);
       
        // Make sure we can copy the same new file to the same target file on the same filesystem
        assertTrue(fileCopy.exists());
        fileCopy.copyFrom(file, Selectors.SELECT_SELF);

        assertSameContent(content, fileCopy);
    }

    /**
 
View Full Code Here

        assertSameContent(content, file);

        // Make sure we can copy the new file to another file on the same filesystem
        FileObject fileCopy = scratchFolder.resolveFile("file1copy.txt");
        assertTrue(!fileCopy.exists());
        fileCopy.copyFrom(file, Selectors.SELECT_SELF);

        assertSameContent(content, fileCopy);

        // Delete the file.
        assertTrue(fileCopy.exists());
View Full Code Here

        assertTrue(fileCopy.exists());
        assertTrue(fileCopy.delete());
       
        // Make sure we can copy the same new file to the same target file on the same filesystem
        assertTrue(!fileCopy.exists());
        fileCopy.copyFrom(file, Selectors.SELECT_SELF);

        assertSameContent(content, fileCopy);
    }

    /**
 
View Full Code Here

        assertSameContent(contentAppend, file);

        // Make sure we can copy the new file to another file on the same filesystem
        FileObject fileCopy = scratchFolder.resolveFile("file1copy.txt");
        assertTrue(!fileCopy.exists());
        fileCopy.copyFrom(file, Selectors.SELECT_SELF);

        assertSameContent(contentAppend, fileCopy);

        // Delete the file.
        assertTrue(fileCopy.exists());
View Full Code Here

        if (dest.exists() && dest.getType() == FileType.FOLDER)
        {
            dest = dest.resolveFile(src.getName().getBaseName());
        }

        dest.copyFrom(src, Selectors.SELECT_ALL);
    }

    /**
     * Does a 'cat' command.
     */
 
View Full Code Here

            if (destFo.getType().equals(FileType.FOLDER)) {
                log.debug("vfs FILE into FOLDER");
                // get a handle on the new file to create at the destination.
                FileObject nestedDestFo = destFo.resolveFile(srcFo.getName().getBaseName());
                // copyFileToFile(srcFo, nestedDestFo, false); //append false here
                nestedDestFo.copyFrom(srcFo, new AllFileSelector());

            } else {
                log.debug("vfs FILE to FILE");
                // copyFileToFile(srcFo, destFo, false); //append false here
                destFo.copyFrom(srcFo, new AllFileSelector());
View Full Code Here

            if (destFo.getType().equals(FileType.FOLDER)) {
                log.debug("vfs FILE into FOLDER");
                // get a handle on the new file to create at the destination.
                FileObject nestedDestFo = destFo.resolveFile(srcFo.getName().getBaseName());
                // copyFileToFile(srcFo, nestedDestFo, false); //append false here
                nestedDestFo.copyFrom(srcFo, new AllFileSelector());

            } else {
                log.debug("vfs FILE to FILE");
                // copyFileToFile(srcFo, destFo, false); //append false here
                destFo.copyFrom(srcFo, new AllFileSelector());
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.