Package com.jcabi.ssh
Interface Shell
-
- All Known Implementing Classes:
Shell.Fake,Shell.Safe,Shell.Verbose,Ssh,SshByPassword
@Immutable public interface Shell
Shell.This interface is implemented by
Sshclass. In order to use it, just make an instance and callexec(String,InputStream,OutputStream,OutputStream)exec()}:String hello = new Shell.Plain( new SSH( "ssh.example.com", 22, "yegor", "-----BEGIN RSA PRIVATE KEY-----..." ) ).exec("echo 'Hello, world!'");- Since:
- 1.0
- See Also:
- article by Yegor Bugayenko
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classShell.EmptyWithout input and output.static classShell.FakeFake shell for unit testing.static classShell.PlainWith output only.static classShell.SafeSafe run (throws if exit code is not zero).static classShell.VerboseVerbose run.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intexec(String command, InputStream stdin, OutputStream stdout, OutputStream stderr)Execute and return exit code.
-
-
-
Method Detail
-
exec
int exec(String command, InputStream stdin, OutputStream stdout, OutputStream stderr) throws IOException
Execute and return exit code.- Parameters:
command- Commandstdin- Stdin (will be closed)stdout- Stdout (will be closed)stderr- Stderr (will be closed)- Returns:
- Exit code
- Throws:
IOException- If fails- Suppressed Checkstyle violations:
- ParameterNumberCheck (5 line)
-
-