P
P
pthon2020-12-19 18:40:08
Java
pthon, 2020-12-19 18:40:08

How to display a new line from the OutputStream?

Hello, there is a code for connecting to ssh, using JSch, how to display only new lines?
The code:

//InputStream inputStream = null;
                String test = "cd pi\npython3 rpi-rf_receive -g " + receiver + "\n";
                InputStream stream = new ByteArrayInputStream(test.getBytes(StandardCharsets.UTF_8));
                Channel channel = session.openChannel("shell");
                channel.setInputStream(stream);
                OutputStream outputStream = new ByteArrayOutputStream();
                channel.setOutputStream(outputStream);
                channel.connect();

                while (!channel.isClosed()) {
                    Log.e("OutputStream", outputStream.toString());
                }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question