ObjectTTYOutputStream
ttyWrite stream object, used for processingttyoutput
There is no way to create this class separately, there are only process.stdout
instances globally
1
2// clear line
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 number of lines in 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, cleaning direction
dir direction:
- -1: Clean from the cursor to the beginning of the line
- 0: clear entire line
- 1: Clean from the cursor to the end of the line
clearScreenDown
Clear characters from the cursor to the end of the screen
1TTYOutputStream.clearScreenDown();
cursorTo
Move the cursor to the specified position
1
2TTYOutputStream.cursorTo(Integer x,
Integer y = -1) async;
Call parameters:
- x: Integer, specified number of columns
- y: Integer, the specified number of rows, the default is -1, which means the number of rows will not be changed
moveCursor
Moves the cursor by the specified offset
1
2TTYOutputStream.moveCursor(Integer dx,
Integer dy) async;
Call parameters:
- dx: Integer, specified column offset
- dy: Integer, specified row offset
getWindowSize
Returns the size of the terminal corresponding to this TTYOutputStream
1NArray TTYOutputStream.getWindowSize();
Return results:
- NArray, returns the 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, specifies the amount of data to be read. The default is to read data blocks of random size. The size of the data read depends on the device.
Return results:
- Buffer, returns the data read from the stream. If there is no data to read or the connection is interrupted, null is returned.
write
Write the given data to the stream
1TTYOutputStream.write(Buffer data) async;
Call parameters:
- data:Buffer, given the data to be written
flush
Write file buffer contents to physical device
1TTYOutputStream.flush() async;
close
Close 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, target stream object
- bytes: Long, number of bytes copied
Return results:
- Long, returns the number of bytes copied
toString
Returns the string representation of the object. Generally, "[Native Object]" is returned. The object can be re-implemented according to its own characteristics.
1String TTYOutputStream.toString();
Return results:
- String, returns the string representation of the object
toJSON
Returns a JSON format representation of the object, generally returning a collection of readable properties defined by the object.
1Value TTYOutputStream.toJSON(String key = "");
Call parameters:
- key: String, not used
Return results:
- Value, returns a value containing JSON serializable