Package ca.pgon.saviorlib.Exceptions

Examples of ca.pgon.saviorlib.Exceptions.FileSystemException


    private class ReadingAutoComplete extends InputStream {
        private InputStream wrapped;

        public ReadingAutoComplete(InputStream wrapped) {
            if (wrapped == null) {
                throw new FileSystemException("Could not read the file");
            }
            this.wrapped = wrapped;
        }
View Full Code Here


       
        @Override
        public void close() throws IOException {
            wrapped.close();
            if (!ftpClient.completePendingCommand()) {
                throw new FileSystemException("The file retrieval was not successful");
            }
        }
View Full Code Here

    private class WritingAutoComplete extends OutputStream {
        private OutputStream wrapped;

        public WritingAutoComplete(OutputStream wrapped) {
            if (wrapped == null) {
                throw new FileSystemException("Could not create the file");
            }
            this.wrapped = wrapped;
        }
View Full Code Here

       
        @Override
        public void close() throws IOException {
            wrapped.close();
            if (!ftpClient.completePendingCommand()) {
                throw new FileSystemException("The file storing was not successful");
            }
        }
View Full Code Here

    }
   
    @Override
    public void checkIfValid() {
        if (basePath == null) {
            throw new FileSystemException("No base path defined");
        }
        if (!new File(basePath).exists()) {
            throw new FileSystemException("The base path does not exists");
        }
    }
View Full Code Here

    @Override
    public void createDirectory(FileEntry directory) {
        File d = new File(FileSystemTools.getAbsolutePath(directory, basePath));
        if (!d.mkdirs()) {
            if (!d.exists()) {
                throw new FileSystemException("Could not create the directory");
            }
        }
    }
View Full Code Here

       
        // Delete the current dir
        File d = new File(FileSystemTools.getAbsolutePath(directory, basePath));
        if (!d.delete()) {
            if (d.exists()) {
                throw new FileSystemException("Could not delete the directory and it is still present");
            }
        }
    }
View Full Code Here

    public OutputStream createFile(FileEntry file) {
        try {
            File f = new File(FileSystemTools.getAbsolutePath(file, basePath));
            return new FileOutputStream(f);
        } catch (FileNotFoundException ex) {
            throw new FileSystemException("Could not create the file", ex);
        }
    }
View Full Code Here

    public OutputStream appendFile(FileEntry file) {
        try {
            File f = new File(FileSystemTools.getAbsolutePath(file, basePath));
            return new FileOutputStream(f, true);
        } catch (FileNotFoundException ex) {
            throw new FileSystemException("Could not append to the file", ex);
        }
    }
View Full Code Here

    @Override
    public void deleteFile(FileEntry file) {
        File f = new File(FileSystemTools.getAbsolutePath(file, basePath));
        if (!f.delete()) {
            if (f.exists()) {
                throw new FileSystemException("Could not delete the file and it is still present");
            }
        }
    }
View Full Code Here

TOP

Related Classes of ca.pgon.saviorlib.Exceptions.FileSystemException

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.