ObjectTTYInputStream
ttyRead stream object, used to readttyread, write
There is no way to create this class separately, there are only process.stdin
instances globally
1process.stdin.read(1)
inheritance relationship
member properties
isTTY
Boolean, always true
1readonly Boolean TTYInputStream.isTTY;
isRaw
Boolean, query whether it is in raw mode, when it is true, it meansttyWhen configured to operate as raw device
1readonly Boolean TTYInputStream.isRaw;
fd
Integer, queryStreamThe corresponding file descriptor value, implemented by subclasses
1readonly Integer TTYInputStream.fd;
member function
setRawMode
set upttyWhether to work in raw mode
1TTYInputStream TTYInputStream.setRawMode(Boolean isRawMode);
Call parameters:
- isRawMode: Boolean, if true, it means working in raw mode; otherwise, working in default mode.
readStream.isRaw
It will be set by this method
Return results:
- TTYInputStream, returns itself
read
Read data of specified size from the stream
1Buffer TTYInputStream.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
1TTYInputStream.write(Buffer data) async;
Call parameters:
- data:Buffer, given the data to be written
flush
Write file buffer contents to physical device
1TTYInputStream.flush() async;
close
Close the current stream object
1TTYInputStream.close() async;
copyTo
Copy stream data to target stream
1
2Long TTYInputStream.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 TTYInputStream.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 TTYInputStream.toJSON(String key = "");
Call parameters:
- key: String, not used
Return results:
- Value, returns a value containing JSON serializable