MCPcopy Index your code
hub / github.com/Juniper/netconf-java / runShellCommand

Method runShellCommand

src/main/java/net/juniper/netconf/Device.java:604–618  ·  view source on GitHub ↗

Execute a command in shell mode. @param command The command to be executed in shell mode. @return Result of the command execution, as a String. Waiting for command output is bounded by #getCommandTimeout(). @throws IOException if there are issues communicating with the Netconf server.

(String command)

Source from the content-addressed store, hash-verified

602 * @throws IOException if there are issues communicating with the Netconf server.
603 */
604 public String runShellCommand(String command) throws IOException {
605 if (!isConnected()) {
606 return "Could not find open connection.";
607 }
608 try (BufferedReader bufferReader = openExecChannelReader(command)) {
609 StringBuilder reply = new StringBuilder();
610 while (true) {
611 String line = bufferReader.readLine();
612 if (line == null || line.equals(NetconfConstants.EMPTY_LINE))
613 break;
614 reply.append(line).append(NetconfConstants.LF);
615 }
616 return reply.toString();
617 }
618 }
619
620 /**
621 * Execute a command in shell mode.

Calls 5

isConnectedMethod · 0.95
openExecChannelReaderMethod · 0.95
appendMethod · 0.80
equalsMethod · 0.45
toStringMethod · 0.45