對象TTYInputStream
沒有途徑可以單獨創建該類, 全局只有 process.stdin
1process.stdin.read(1)
繼承關係
成員屬性
isTTY
Boolean, 恆為true
1readonly Boolean TTYInputStream.isTTY;
isRaw
Boolean, 查詢是否是處於raw mode, 為true 時, 表示 tty 被配置為以raw device 操作時
1readonly Boolean TTYInputStream.isRaw;
fd
Integer, 查詢 Stream 對應的文件描述符值, 由子類實現
1readonly Integer TTYInputStream.fd;
成員函數
setRawMode
設置 tty 是否以raw mode 工作
1TTYInputStream TTYInputStream.setRawMode(Boolean isRawMode);
調用參數:
- isRawMode: Boolean, 為true, 表示以raw mode 工作; 否則以默認模式工作.
readStream.isRaw
返回結果:
- TTYInputStream, 返回自身
read
從流內讀取指定大小的數據
1Buffer TTYInputStream.read(Integer bytes = -1) async;
調用參數:
- bytes: Integer, 指定要讀取的數據量,缺省為讀取隨機大小的數據塊,讀出的數據尺寸取決於設備
返回結果:
- Buffer, 返回從流內讀取的數據,若無數據可讀,或者連接中斷,則返回null
write
將給定的數據寫入流
1TTYInputStream.write(Buffer data) async;
調用參數:
- data: Buffer, 給定要寫入的數據
flush
將文件緩衝區內容寫入物理設備
1TTYInputStream.flush() async;
close
關閉當前流對象
1TTYInputStream.close() async;
copyTo
複製流數據到目標流中
1
2Long TTYInputStream.copyTo(Stream stm,
Long bytes = -1) async;
調用參數:
- stm: Stream, 目標流對象
- bytes: Long, 複製的字節數
返回結果:
- Long, 返回複製的字節數
toString
返回對象的字符串表示,一般返回"[Native Object]",對象可以根據自己的特性重新實現
1String TTYInputStream.toString();
返回結果:
- String, 返回對象的字符串表示
toJSON
返回對象的JSON 格式表示,一般返回對象定義的可讀屬性集合
1Value TTYInputStream.toJSON(String key = "");
調用參數:
- key: String, 未使用
返回結果:
- Value, 返回包含可JSON 序列化的值