public class PTY extends Object
Modifier and Type | Class and Description |
---|---|
class |
PTY.MasterFD
The master fd is used on two streams.
|
Constructor and Description |
---|
PTY()
Create PTY for use with Eclipse console.
|
PTY(boolean console)
Create pseudo-terminal.
|
Modifier and Type | Method and Description |
---|---|
InputStream |
getInputStream() |
PTY.MasterFD |
getMasterFD() |
OutputStream |
getOutputStream() |
String |
getSlaveName() |
boolean |
isConsole() |
static boolean |
isSupported() |
void |
setTerminalSize(int width,
int height)
Change terminal window size to given width and height.
|
public PTY() throws IOException
PTY(true)
.IOException
- if something goes wrong.public PTY(boolean console) throws IOException
The provided flag indicates whether the pseudo terminal is used with the interactive Eclipse console:
true
the terminal is configured with no echo and stderr is redirected to a pipe instead of the
PTY.false
the terminal is configured with echo and stderr is connected to the PTY. This mode is
best suited for use with a proper terminal emulation. Note that this mode might not be supported on all platforms.
Known platforms which support this mode are: linux-x86
, linux-x86_64
,
solaris-sparc
, macosx
.console
- whether terminal is used with Eclipse consoleIOException
- if the PTY could not be createdpublic String getSlaveName()
public PTY.MasterFD getMasterFD()
public final boolean isConsole()
public OutputStream getOutputStream()
public InputStream getInputStream()
public final void setTerminalSize(int width, int height)
This should only be used when the pseudo terminal is configured for use with a terminal emulation, i.e. when
isConsole()
returns false
.
Note: This method may not be supported on all platforms. Known platforms which support this method
are: linux-x86
, linux-x86_64
, solaris-sparc
, macosx
.
width
- the given width.height
- the given height.public static boolean isSupported()
Copyright © 2024. All rights reserved.