Do you need working code for command execution? (put some command on channel, get back the data)?
On Thu, Jan 8, 2015 at 6:44 PM, Martin Lichtin <[email protected]> wrote: > Hi > > I'm confused about AbstractClientChannel.getOut() being deprecated. > It's just a getter method to complement setOut(), not? > > The comment > /** > * @deprecated Use {@link #getInvertedIn()} instead > */ > also is puzzling. Can anyone clarify? > > My use case (simplified) is: > > ChannelExec channelExec = clientSession.createExecChannel(cmd); > ByteArrayOutputStream stdOut = new ByteArrayOutputStream(); > ByteArrayOutputStream stdErr = new ByteArrayOutputStream(); > channelExec.setOut(stdOut); > channelExec.setErr(stdErr); > OpenFuture openFuture = channelExec.open(); > openFuture.await(); > channelExec.waitFor(ClientChannel.CLOSED, COMMAND_TIMEOUT_MS); > > and later I do > > String cmdOutput = ((ByteArrayOutputStream) channelExec.getOut()). > toString("UTF-8"); > > - Martin > >
