Object built-in object

Object TTYOutputStream

tty Write stream object for processing tty Output

There is no way you can create a separate class, globally only process.stdoutexamples

1 2
// 清除屏幕上光标以右的内容 process.stdout.clearLine(1)

Inheritance

#lineWidth: 1.5 #font: Helvetica,sans-Serif #fontSize: 10 #leading: 1.6 #.this: fill=lightgray #.class: fill=white [<class>object|toString();toJSON()] [<class>Stream|fd|read();write();flush();close();copyTo()] [<this>TTYOutputStream|isTTY|clearLine();clearScreenDown()] [object] <:- [Stream] [Stream] <:- [TTYOutputStream] Stream fd read() write() flush() close() copyTo() TTYOutputStream isTTY clearLine() clearScreenDown() object toString() toJSON()

Member attributes

isTTY

Boolean, always true

1
readonly Boolean TTYOutputStream.isTTY;

fd

Integer, query Stream The corresponding file descriptor value, implemented by the subclass

1
readonly Integer TTYOutputStream.fd;

Member function

clearLine

Clear line according to the direction indicated by dir

1
TTYOutputStream.clearLine(Integer dir = 0);

Call parameters:

  • dir: Integer, cleaning direction

The direction of dir:

  • -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 characters from the cursor to the end of the screen

1
TTYOutputStream.clearScreenDown();

read

Read data of the specified size from the stream

1
Buffer 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, Return the data read from the stream, if there is no data to read, or the connection is interrupted, then return null

write

Write the given data to the stream

1
TTYOutputStream.write(Buffer data) async;

Call parameters:

  • data: Buffer, Given the data to be written

flush

Write the contents of the file buffer to the physical device

1
TTYOutputStream.flush() async;

close

Close the current stream object

1
TTYOutputStream.close() async;

copyTo

Copy the stream data to the target stream

1 2
Long TTYOutputStream.copyTo(Stream stm, Long bytes = -1) async;

Call parameters:

  • stm: Stream, The target stream object
  • bytes: Long, the 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 re-implemented according to its own characteristics

1
String TTYOutputStream.toString();

Return result:

  • String, Returns the string representation of the object

toJSON

Returns the JSON format representation of the object, generally returns a collection of readable attributes defined by the object

1
Value TTYOutputStream.toJSON(String key = "");

Call parameters:

  • key: String, unused

Return result:

  • Value, Returns a value containing JSON serializable