Package com.tailf.ned
Class SSHJSession
Object
com.tailf.ned.SSHJSession
- All Implemented Interfaces:
CliSession
,SSHClient.CliSession
Class implementing the SSHClient.CliSession interface using
the net.schmizz.sshj framework.
- Author:
- jrendel
-
Field Summary
Fields inherited from interface com.tailf.ned.SSHClient.CliSession
MODE_OCRNL, MODE_ONLRET, MODE_ONOCR
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the SSH sessiongetLine()
Return the line bufferReturn the session input readerint
Return the configured read timeoutGet configured println modeReturn the session output writervoid
Log on debug levelvoid
Log on info levelboolean
ready
(int timeout) Checks if the input reader is ready for reading.boolean
Returns true if session has been closedvoid
setReadTimeout
(int readTimeout) Configure the readTimeoutvoid
setTermPrintlnMode
(String mode) Configure println modevoid
Enable tracervoid
Append to tracervoid
traceInBufAppend
(String msg) Append to trace in bufvoid
Flush trace in buffer
-
Method Details
-
ready
Checks if the input reader is ready for reading. Done with a blocking read in a separate thread. Called through a Java Future to ensure timeout exception.- Specified by:
ready
in interfaceSSHClient.CliSession
- Parameters:
timeout
- timeout- Returns:
- true if the input reader is ready, false otherwise
- Throws:
IOException
- if an I/O error occurs
-
serverSideClosed
public boolean serverSideClosed()Returns true if session has been closed- Specified by:
serverSideClosed
in interfaceCliSession
-
close
public void close()Close the SSH session- Specified by:
close
in interfaceCliSession
-
getReadTimeout
public int getReadTimeout()Return the configured read timeout- Specified by:
getReadTimeout
in interfaceSSHClient.CliSession
-
setReadTimeout
public void setReadTimeout(int readTimeout) Configure the readTimeout- Specified by:
setReadTimeout
in interfaceSSHClient.CliSession
-
getReader
Return the session input reader- Specified by:
getReader
in interfaceSSHClient.CliSession
-
getWriter
Return the session output writer- Specified by:
getWriter
in interfaceSSHClient.CliSession
-
getLine
Return the line buffer- Specified by:
getLine
in interfaceSSHClient.CliSession
-
setTracer
Enable tracer- Specified by:
setTracer
in interfaceCliSession
-
trace
Append to tracer- Specified by:
trace
in interfaceSSHClient.CliSession
-
traceInBufAppend
Append to trace in buf- Specified by:
traceInBufAppend
in interfaceSSHClient.CliSession
-
traceInBufFlush
public void traceInBufFlush()Flush trace in buffer- Specified by:
traceInBufFlush
in interfaceSSHClient.CliSession
-
logInfo
Log on info level- Specified by:
logInfo
in interfaceSSHClient.CliSession
-
logDebug
Log on debug level- Specified by:
logDebug
in interfaceSSHClient.CliSession
-
getTermPrintlnMode
Get configured println mode- Specified by:
getTermPrintlnMode
in interfaceSSHClient.CliSession
-
setTermPrintlnMode
Configure println mode- Specified by:
setTermPrintlnMode
in interfaceSSHClient.CliSession
-
getInputStream
- Specified by:
getInputStream
in interfaceSSHClient.CliSession
-
getErrorStream
- Specified by:
getErrorStream
in interfaceSSHClient.CliSession
-
getOutputStream
- Specified by:
getOutputStream
in interfaceSSHClient.CliSession
-