mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-09 18:15:23 +02:00
Improve Javadoc in HostShellProcessAdapter
This commit is contained in:
parent
2d7ba36e38
commit
2f2da842d1
2 changed files with 26 additions and 9 deletions
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Ewa Matejska (PalmSource)
|
* Ewa Matejska (PalmSource)
|
||||||
* Martin Oberhuber (Wind River) - moved from org.eclipse.rse.remotecdt (bug 161777)
|
* Martin Oberhuber (Wind River) - moved from org.eclipse.rse.remotecdt (bug 161777)
|
||||||
|
* Martin Oberhuber (Wind River) - improved Javadoc
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.services.shells;
|
package org.eclipse.rse.services.shells;
|
||||||
|
@ -27,6 +28,7 @@ public class HostShellOutputStream extends OutputStream {
|
||||||
private IHostShell hostShell;
|
private IHostShell hostShell;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Constructor.
|
||||||
* @param hostShell An instance of the IHostShell class.
|
* @param hostShell An instance of the IHostShell class.
|
||||||
* The output will be sent to this instance.
|
* The output will be sent to this instance.
|
||||||
*/
|
*/
|
||||||
|
@ -36,6 +38,7 @@ public class HostShellOutputStream extends OutputStream {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes one byte to the shell.
|
* Writes one byte to the shell.
|
||||||
|
* @see java.io.OutputStream#write(byte[])
|
||||||
*/
|
*/
|
||||||
public void write(byte[] b) {
|
public void write(byte[] b) {
|
||||||
if(hostShell != null && b != null)
|
if(hostShell != null && b != null)
|
||||||
|
@ -44,6 +47,7 @@ public class HostShellOutputStream extends OutputStream {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes multiple bytes to the shell.
|
* Writes multiple bytes to the shell.
|
||||||
|
* @see java.io.OutputStream#write(byte[], int, int)
|
||||||
*/
|
*/
|
||||||
public void write(byte[] b, int off, int len) {
|
public void write(byte[] b, int off, int len) {
|
||||||
if(hostShell != null && b != null)
|
if(hostShell != null && b != null)
|
||||||
|
@ -52,6 +56,7 @@ public class HostShellOutputStream extends OutputStream {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes one character to the shell.
|
* Writes one character to the shell.
|
||||||
|
* @see java.io.OutputStream#write(int)
|
||||||
*/
|
*/
|
||||||
public void write(int b) throws IOException {
|
public void write(int b) throws IOException {
|
||||||
char[] array = { (char) b };
|
char[] array = { (char) b };
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
* Martin Oberhuber (Wind River) - adapt to IHostOutput API (bug 161773, 158312)
|
* Martin Oberhuber (Wind River) - adapt to IHostOutput API (bug 161773, 158312)
|
||||||
* Martin Oberhuber (Wind River) - moved from org.eclipse.rse.remotecdt (bug 161777)
|
* Martin Oberhuber (Wind River) - moved from org.eclipse.rse.remotecdt (bug 161777)
|
||||||
* Martin Oberhuber (Wind River) - renamed from HostShellAdapter (bug 161777)
|
* Martin Oberhuber (Wind River) - renamed from HostShellAdapter (bug 161777)
|
||||||
|
* Martin Oberhuber (Wind River) - improved Javadoc
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.services.shells;
|
package org.eclipse.rse.services.shells;
|
||||||
|
@ -26,8 +27,8 @@ import java.io.PipedOutputStream;
|
||||||
* represent one process running in the shell. This means
|
* represent one process running in the shell. This means
|
||||||
* that the output of multiple shell commands will be returned
|
* that the output of multiple shell commands will be returned
|
||||||
* until the shell exits.
|
* until the shell exits.
|
||||||
* @author Ewa Matejska
|
|
||||||
*
|
*
|
||||||
|
* @author Ewa Matejska
|
||||||
*/
|
*/
|
||||||
public class HostShellProcessAdapter extends Process implements
|
public class HostShellProcessAdapter extends Process implements
|
||||||
IHostShellOutputListener {
|
IHostShellOutputListener {
|
||||||
|
@ -41,7 +42,7 @@ IHostShellOutputListener {
|
||||||
private PipedOutputStream hostShellError = null;
|
private PipedOutputStream hostShellError = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Constructor.
|
||||||
* @param hostShell An instance of the IHostShell class.
|
* @param hostShell An instance of the IHostShell class.
|
||||||
* @throws java.io.IOException
|
* @throws java.io.IOException
|
||||||
*/
|
*/
|
||||||
|
@ -58,6 +59,7 @@ IHostShellOutputListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exits the shell.
|
* Exits the shell.
|
||||||
|
* @see java.lang.Process#destroy()
|
||||||
*/
|
*/
|
||||||
public synchronized void destroy() {
|
public synchronized void destroy() {
|
||||||
hostShell.exit();
|
hostShell.exit();
|
||||||
|
@ -69,6 +71,7 @@ IHostShellOutputListener {
|
||||||
errorStream.close();
|
errorStream.close();
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
//FIXME IOException when closing one of the streams will leave others open
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,6 +89,7 @@ IHostShellOutputListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the error stream of the shell.
|
* Returns the error stream of the shell.
|
||||||
|
* @see java.lang.Process#getErrorStream()
|
||||||
*/
|
*/
|
||||||
public InputStream getErrorStream() {
|
public InputStream getErrorStream() {
|
||||||
return errorStream;
|
return errorStream;
|
||||||
|
@ -93,6 +97,7 @@ IHostShellOutputListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the input stream for the shell.
|
* Returns the input stream for the shell.
|
||||||
|
* @see java.lang.Process#getInputStream()
|
||||||
*/
|
*/
|
||||||
public InputStream getInputStream() {
|
public InputStream getInputStream() {
|
||||||
return inputStream;
|
return inputStream;
|
||||||
|
@ -100,6 +105,7 @@ IHostShellOutputListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the output stream for the shell.
|
* Returns the output stream for the shell.
|
||||||
|
* @see java.lang.Process#getOutputStream()
|
||||||
*/
|
*/
|
||||||
public OutputStream getOutputStream() {
|
public OutputStream getOutputStream() {
|
||||||
return outputStream;
|
return outputStream;
|
||||||
|
@ -107,6 +113,7 @@ IHostShellOutputListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits for the shell to exit.
|
* Waits for the shell to exit.
|
||||||
|
* @see java.lang.Process#waitFor()
|
||||||
*/
|
*/
|
||||||
public synchronized int waitFor() throws InterruptedException {
|
public synchronized int waitFor() throws InterruptedException {
|
||||||
|
|
||||||
|
@ -136,6 +143,11 @@ IHostShellOutputListener {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process an RSE Shell event, by writing the lines of text contained
|
||||||
|
* in the event into the adapter's streams.
|
||||||
|
* @see org.eclipse.rse.services.shells.IHostShellOutputListener#shellOutputChanged(org.eclipse.rse.services.shells.IHostShellChangeEvent)
|
||||||
|
*/
|
||||||
public void shellOutputChanged(IHostShellChangeEvent event) {
|
public void shellOutputChanged(IHostShellChangeEvent event) {
|
||||||
IHostOutput[] input = event.getLines();
|
IHostOutput[] input = event.getLines();
|
||||||
OutputStream outputStream = event.isError() ? hostShellError : hostShellInput;
|
OutputStream outputStream = event.isError() ? hostShellError : hostShellInput;
|
||||||
|
|
Loading…
Add table
Reference in a new issue