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
Ssh
class. 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 class
Shell.Empty
Without input and output.static class
Shell.Fake
Fake shell for unit testing.static class
Shell.Plain
With output only.static class
Shell.Safe
Safe run (throws if exit code is not zero).static class
Shell.Verbose
Verbose run.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
exec(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)
-
-