Object built-in object

object TTYInputStream

ttyRead stream object, used tottyread, write

There is no way to create the class alone, only the process.stdininstance

1
process.stdin.read(1)

inheritance relationship

#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>TTYInputStream|isTTY;isRaw|setRawMode()] [object] <:- [Stream] [Stream] <:- [TTYInputStream] Stream fd read() write() flush() close() copyTo() TTYInputStream isTTY isRaw setRawMode() object toString() toJSON()

Member properties

isTTY

Boolean, always true

1
readonly Boolean TTYInputStream.isTTY;

isRaw

Boolean, whether the query is in raw mode, when true, meansttyWhen configured to operate as raw device

1
readonly Boolean TTYInputStream.isRaw;

fd

Integer, queryStreamThe corresponding file descriptor value, implemented by subclasses

1
readonly Integer TTYInputStream.fd;

member function

setRawMode

set upttywhether to work in raw mode

1
TTYInputStream TTYInputStream.setRawMode(Boolean isRawMode);

Call parameters:

  • isRawMode: Boolean, is true, it means to work in raw mode; otherwise, it works in default mode. readStream.isRawIt will be set by this method

Return result:

  • TTYInputStream, returns itself

read

Read data of specified size from the stream

1
Buffer TTYInputStream.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

1
TTYInputStream.write(Buffer data) async;

Call parameters:

  • data:Buffer, given the data to write

flush

Write file buffer contents to physical device

1
TTYInputStream.flush() async;

close

closes the current stream object

1
TTYInputStream.close() async;

copyTo

Copy stream data to target stream

1 2
Long TTYInputStream.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

1
String TTYInputStream.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

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

Call parameters:

  • key: String, unused

Return result:

  • Value, returns a value containing JSON serializable