Package org.apache.sshd.server

Examples of org.apache.sshd.server.SshFile.doesExist()


                    {
                        basedir = pattern.substring( 0, lastSep );
                        pattern = pattern.substring( lastSep + 1 );
                    }
                    SshFile file = root.getFile( basedir + "/" + pattern );
                    if ( !file.doesExist() )
                    {
                        exitValue = WARNING;
                        throw new IOException( file + ": no such file or directory" );
                    }
                    if ( file.isFile() )
View Full Code Here


        }
        else
        {
            throw new IOException( "Can not write to " + path );
        }
        if ( !( file.doesExist() && file.isDirectory() ) && !file.mkdir() )
        {
            throw new IOException( "Could not create directory " + file );
        }

        ack();
View Full Code Here

        }
        else
        {
            throw new IOException( "Can not write to " + path );
        }
        if ( file.doesExist() && file.isDirectory() )
        {
            throw new IOException( "File is a directory: " + file );
        }
        else if ( file.doesExist() && !file.isWritable() )
        {
View Full Code Here

        }
        if ( file.doesExist() && file.isDirectory() )
        {
            throw new IOException( "File is a directory: " + file );
        }
        else if ( file.doesExist() && !file.isWritable() )
        {
            throw new IOException( "Can not write to file: " + file );
        }
        OutputStream os = file.createOutputStream( 0 );
        try
View Full Code Here

                    String path = buffer.getString();
                    int pflags = buffer.getInt();
                    // attrs
                    try {
                        SshFile file = resolveFile(path);
                        if (file.doesExist()) {
                            if (((pflags & SSH_FXF_CREAT) != 0) && ((pflags & SSH_FXF_EXCL) != 0)) {
                                sendStatus(id, SSH_FX_FILE_ALREADY_EXISTS, path);
                                return;
                            }
                        } else {
View Full Code Here

                    // attrs
                    try {
                        SshFile file = resolveFile(path);
                        switch (flags & SSH_FXF_ACCESS_DISPOSITION) {
                            case SSH_FXF_CREATE_NEW: {
                                if (file.doesExist()) {
                                    sendStatus(id, SSH_FX_FILE_ALREADY_EXISTS, path);
                                    return;
                                } else if (!file.isWritable()) {
                                    sendStatus(id, SSH_FX_FAILURE, "Can not create " + path);
                                }
View Full Code Here

                                    sendStatus(id, SSH_FX_FAILURE, "Can not create " + path);
                                }
                                break;
                            }
                            case SSH_FXF_CREATE_TRUNCATE: {
                                if (file.doesExist()) {
                                    sendStatus(id, SSH_FX_FILE_ALREADY_EXISTS, path);
                                    return;
                                } else if (!file.isWritable()) {
                                    sendStatus(id, SSH_FX_FAILURE, "Can not create " + path);
                                }
View Full Code Here

                                }
                                file.truncate();
                                break;
                            }
                            case SSH_FXF_OPEN_EXISTING: {
                                if (!file.doesExist()) {
                                    if (!file.getParentFile().doesExist()) {
                                        sendStatus(id, SSH_FX_NO_SUCH_PATH, path);
                                    } else {
                                        sendStatus(id, SSH_FX_NO_SUCH_FILE, path);
                                    }
View Full Code Here

                            }
                            case SSH_FXF_OPEN_OR_CREATE: {
                                break;
                            }
                            case SSH_FXF_TRUNCATE_EXISTING: {
                                if (!file.doesExist()) {
                                    if (!file.getParentFile().doesExist()) {
                                        sendStatus(id, SSH_FX_NO_SUCH_PATH, path);
                                    } else {
                                        sendStatus(id, SSH_FX_NO_SUCH_FILE, path);
                                    }
View Full Code Here

            }
            case SSH_FXP_OPENDIR: {
                String path = buffer.getString();
                try {
                    SshFile p = resolveFile(path);
                    if (!p.doesExist()) {
                        sendStatus(id, SSH_FX_NO_SUCH_FILE, path);
                    } else if (!p.isDirectory()) {
                        sendStatus(id, SSH_FX_NOT_A_DIRECTORY, path);
                    } else if (!p.isReadable()) {
                        sendStatus(id, SSH_FX_PERMISSION_DENIED, path);
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.