Package org.springframework.roo.process.manager

Examples of org.springframework.roo.process.manager.MutableFile


    private void createOrReplaceFile(String path, String fileName) {
        String targetFile = path + SEPARATOR + fileName;
       
        // Use MutableFile in combination with FileManager to take advantage of Roo's transactional file handling which
        // offers automatic rollback if an exception occurs
        MutableFile mutableFile = fileManager.exists(targetFile) ? fileManager.updateFile(targetFile) : fileManager.createFile(targetFile);
        InputStream inputStream = null;
        OutputStream outputStream = null;
        try {
            // Use FileUtils to open an InputStream to a resource located in your bundle
            inputStream = FileUtils.getInputStream(getClass(), fileName);
            outputStream =  mutableFile.getOutputStream();
            IOUtils.copy(inputStream, outputStream);
        } catch (IOException e) {
            throw new IllegalStateException(e);
        } finally {
            IOUtils.closeQuietly(inputStream);
View Full Code Here

TOP

Related Classes of org.springframework.roo.process.manager.MutableFile

Copyright © 2018 www.massapicom. 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.