Object TTYOutputStream
ttywrite stream object, for processingttyoutput
There is no way to create the class alone, only the process.stdout
instance
1
2// 清除屏幕上光标以右的内容
process.stdout.clearLine(1)
inheritance relationship
Member properties
isTTY
Boolean, always true
1readonly Boolean TTYOutputStream.isTTY;
columns
Integer, returns the number of columns of the terminal corresponding to this TTYOutputStream
1readonly Integer TTYOutputStream.columns;
rows
Integer, returns the line number of the terminal corresponding to this TTYOutputStream
1readonly Integer TTYOutputStream.rows;
fd
Integer, queryStreamThe corresponding file descriptor value, implemented by subclasses
1readonly Integer TTYOutputStream.fd;
member function
clearLine
clear line according to the direction indicated by dir
1TTYOutputStream.clearLine(Integer dir = 0);
Call parameters:
- dir: Integer, clear direction
dir direction:
- -1: clean up from the cursor to the beginning of the line
- 0: clean up the entire line
- 1: clean up from the cursor to the end of the line
clearScreenDown
Clear the characters from the cursor to the end of the screen
1TTYOutputStream.clearScreenDown();
getWindowSize
Returns the size of the terminal corresponding to this TTYOutputStream
1NArray TTYOutputStream.getWindowSize();
Return result:
- NArray, returns an array [numColumns, numRows], where numColumns and numRows represent the number of columns and rows in the corresponding terminal
read
Read data of specified size from the stream
1Buffer TTYOutputStream.read(Integer bytes = -1) async;
Call parameters:
- bytes: Integer, specify the amount of data to be read, the default is to read a random size data block, the size of the data read depends on the device
Return result:
- Buffer, returns the data read from the stream, or null if there is no data to read or the connection is interrupted
write
Write the given data to the stream
1TTYOutputStream.write(Buffer data) async;
Call parameters:
- data:Buffer, given the data to write
flush
Write file buffer contents to physical device
1TTYOutputStream.flush() async;
close
closes the current stream object
1TTYOutputStream.close() async;
copyTo
Copy stream data to target stream
1
2Long TTYOutputStream.copyTo(Stream stm,
Long bytes = -1) async;
Call parameters:
- stm:Stream, the target stream object
- bytes: Long, number of bytes copied
Return result:
- Long, returns the number of bytes copied
toString
Returns the string representation of the object, generally returns "[Native Object]", the object can be reimplemented according to its own characteristics
1String TTYOutputStream.toString();
Return result:
- String, returns the string representation of the object
toJSON
Returns the JSON format representation of the object, generally returns the set of readable properties defined by the object
1Value TTYOutputStream.toJSON(String key = "");
Call parameters:
- key: String, unused
Return result:
- Value, returns a value containing JSON serializable