Package org.apache.roller.business

Examples of org.apache.roller.business.FileIOException


        }
       
        // make sure we are allowed to save this file
        RollerMessages msgs = new RollerMessages();
        if (!canSave(weblog, savePath, contentType, size, msgs)) {
            throw new FileIOException(msgs.toString());
        }
       
        // make sure uploads area exists for this weblog
        File dirPath = this.getRealFile(weblog, null);
        File saveFile = new File(dirPath.getAbsolutePath() + File.separator + savePath);
       
        byte[] buffer = new byte[8192];
        int bytesRead = 0;
        OutputStream bos = null;
        try {
            bos = new FileOutputStream(saveFile);
            while ((bytesRead = is.read(buffer, 0, 8192)) != -1) {
                bos.write(buffer, 0, bytesRead);
            }
           
            log.debug("The file has been written to ["+saveFile.getAbsolutePath()+"]");
        } catch (Exception e) {
            throw new FileIOException("ERROR uploading file", e);
        } finally {
            try {
                bos.flush();
                bos.close();
            } catch (Exception ignored) {}
View Full Code Here


        }
       
        // create it
        if(!dir.mkdir()) {
            // failed for some reason
            throw new FileIOException("Failed to create directory ["+path+"], "+
                    "probably doesn't have needed parent directories.");
        }
    }
View Full Code Here

       
        // get path to delete file, checks that path exists and is readable
        File delFile = this.getRealFile(weblog, path);
       
        if(!delFile.delete()) {
            throw new FileIOException("Delete failed for ["+path+"], "+
                    "possibly a non-empty directory?");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.roller.business.FileIOException

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.