Class JniNativePty
- java.lang.Object
-
- org.jline.terminal.impl.AbstractPty
-
- org.jline.terminal.impl.jni.JniNativePty
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,Pty
- Direct Known Subclasses:
FreeBsdNativePty
,LinuxNativePty
,OsXNativePty
,SolarisNativePty
public abstract class JniNativePty extends AbstractPty implements Pty
-
-
Field Summary
-
Fields inherited from class org.jline.terminal.impl.AbstractPty
provider, systemStream
-
-
Constructor Summary
Constructors Constructor Description JniNativePty(TerminalProvider provider, SystemStream systemStream, int master, java.io.FileDescriptor masterFD, int slave, java.io.FileDescriptor slaveFD, int slaveOut, java.io.FileDescriptor slaveOutFD, java.lang.String name)
JniNativePty(TerminalProvider provider, SystemStream systemStream, int master, java.io.FileDescriptor masterFD, int slave, java.io.FileDescriptor slaveFD, java.lang.String name)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
protected java.io.InputStream
doGetSlaveInput()
protected void
doSetAttr(Attributes attr)
Attributes
getAttr()
Returns the current terminal attributes for this PTY.int
getMaster()
java.io.FileDescriptor
getMasterFD()
java.io.InputStream
getMasterInput()
Returns the input stream for the master side of the PTY.java.io.OutputStream
getMasterOutput()
Returns the output stream for the master side of the PTY.java.lang.String
getName()
Size
getSize()
Returns the current size (dimensions) of this PTY.int
getSlave()
java.io.FileDescriptor
getSlaveFD()
int
getSlaveOut()
java.io.FileDescriptor
getSlaveOutFD()
java.io.OutputStream
getSlaveOutput()
Returns the output stream for the slave side of the PTY.static boolean
isPosixSystemStream(SystemStream stream)
static java.lang.String
posixSystemStreamName(SystemStream systemStream)
void
setSize(Size size)
Sets the size (dimensions) of this PTY.static int
systemStreamWidth(SystemStream systemStream)
protected abstract Attributes
toAttributes(CLibrary.Termios tios)
java.lang.String
toString()
protected abstract CLibrary.Termios
toTermios(Attributes t)
protected static java.lang.String
ttyname(int fd)
-
Methods inherited from class org.jline.terminal.impl.AbstractPty
checkInterrupted, getProvider, getSlaveInput, getSystemStream, newDescriptor, setAttr
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jline.terminal.spi.Pty
getProvider, getSlaveInput, getSystemStream, setAttr
-
-
-
-
Constructor Detail
-
JniNativePty
public JniNativePty(TerminalProvider provider, SystemStream systemStream, int master, java.io.FileDescriptor masterFD, int slave, java.io.FileDescriptor slaveFD, java.lang.String name)
-
JniNativePty
public JniNativePty(TerminalProvider provider, SystemStream systemStream, int master, java.io.FileDescriptor masterFD, int slave, java.io.FileDescriptor slaveFD, int slaveOut, java.io.FileDescriptor slaveOutFD, java.lang.String name)
-
-
Method Detail
-
ttyname
protected static java.lang.String ttyname(int fd) throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
getMaster
public int getMaster()
-
getSlave
public int getSlave()
-
getSlaveOut
public int getSlaveOut()
-
getName
public java.lang.String getName()
-
getMasterFD
public java.io.FileDescriptor getMasterFD()
-
getSlaveFD
public java.io.FileDescriptor getSlaveFD()
-
getSlaveOutFD
public java.io.FileDescriptor getSlaveOutFD()
-
getMasterInput
public java.io.InputStream getMasterInput()
Description copied from interface:Pty
Returns the input stream for the master side of the PTY.This stream receives data that has been written to the slave's output stream. Terminal emulators typically read from this stream to get the output from processes running in the terminal.
- Specified by:
getMasterInput
in interfacePty
- Returns:
- the master's input stream
-
getMasterOutput
public java.io.OutputStream getMasterOutput()
Description copied from interface:Pty
Returns the output stream for the master side of the PTY.Data written to this stream will be available for reading from the slave's input stream. Terminal emulators typically write to this stream to send input to processes running in the terminal.
- Specified by:
getMasterOutput
in interfacePty
- Returns:
- the master's output stream
-
doGetSlaveInput
protected java.io.InputStream doGetSlaveInput()
- Specified by:
doGetSlaveInput
in classAbstractPty
-
getSlaveOutput
public java.io.OutputStream getSlaveOutput()
Description copied from interface:Pty
Returns the output stream for the slave side of the PTY.Data written to this stream will be available for reading from the master's input stream. Processes running in the terminal write to this stream to produce their output.
- Specified by:
getSlaveOutput
in interfacePty
- Returns:
- the slave's output stream
-
getAttr
public Attributes getAttr() throws java.io.IOException
Description copied from interface:Pty
Returns the current terminal attributes for this PTY.Terminal attributes control various aspects of terminal behavior, such as echo settings, line discipline, and control characters.
- Specified by:
getAttr
in interfacePty
- Returns:
- the current terminal attributes
- Throws:
java.io.IOException
- if an I/O error occurs- See Also:
Attributes
-
doSetAttr
protected void doSetAttr(Attributes attr) throws java.io.IOException
- Specified by:
doSetAttr
in classAbstractPty
- Throws:
java.io.IOException
-
getSize
public Size getSize() throws java.io.IOException
Description copied from interface:Pty
Returns the current size (dimensions) of this PTY.The size includes the number of rows and columns in the terminal window.
-
setSize
public void setSize(Size size) throws java.io.IOException
Description copied from interface:Pty
Sets the size (dimensions) of this PTY.This method changes the number of rows and columns in the terminal window. When the size changes, a SIGWINCH signal is typically sent to processes running in the terminal.
-
toTermios
protected abstract CLibrary.Termios toTermios(Attributes t)
-
toAttributes
protected abstract Attributes toAttributes(CLibrary.Termios tios)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
isPosixSystemStream
public static boolean isPosixSystemStream(SystemStream stream)
-
posixSystemStreamName
public static java.lang.String posixSystemStreamName(SystemStream systemStream)
-
systemStreamWidth
public static int systemStreamWidth(SystemStream systemStream)
-
-