Interface Connector
-
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable
- All Known Implementing Classes:
AbstractConnector,PageantConnector,UnixDomainSocketConnector,WinPipeConnector
public interface Connector extends java.io.CloseableSimple interface for connecting to something and making RPC-style request-reply calls.- Since:
- 6.0
- See Also:
ConnectorFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleanconnect()Connects to an SSH agent if there is one running.default byte[]rpc(byte command)Performs a remote call sending only a command without any parameters to the SSH agent and returns the result.byte[]rpc(byte command, byte[] message)Performs a remote call to the SSH agent and returns the result.
-
-
-
Method Detail
-
connect
boolean connect() throws java.io.IOExceptionConnects to an SSH agent if there is one running. If called when already connected just returnstrue.- Returns:
trueif an SSH agent is available and connected, if no SSH agent is available- Throws:
java.io.IOException- if connecting to the SSH agent failed
-
rpc
byte[] rpc(byte command, byte[] message) throws java.io.IOExceptionPerforms a remote call to the SSH agent and returns the result.- Parameters:
command- to sendmessage- to send; must have at least 5 bytes, and must have 5 unused bytes at the front.- Returns:
- the result received
- Throws:
java.io.IOException- if an error occurs
-
rpc
default byte[] rpc(byte command) throws java.io.IOExceptionPerforms a remote call sending only a command without any parameters to the SSH agent and returns the result.- Parameters:
command- to send- Returns:
- the result received
- Throws:
java.io.IOException- if an error occurs
-
-