0
用下面的代碼我想從spawn.send("ls | grep *.dat\n");
讀取InputStream。我的執行Spawnable
和它的方法,但沒有線索如何使用它。 ExpectJ docs說:- 獲取一個可讀取Spawn標準輸出的流。但是這並沒有讓我有任何進展。expectJ - 從spawn.send()讀取InputStream()
private void expectC() throws IOException, TimeoutException, ExpectJException, InterruptedException {
ExpectJ expectJ = new ExpectJ();
Spawn spawn = expectJ.spawn("192.168.1.60", 22, "login", "pass");
spawn.send("ls | grep *.dat\n");
spawn.expectClose();
}