Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 46 additions & 47 deletions types/fibjs/declare/BufferedStream.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* *
***************************************************************************/

/**
/**
* @author Richard <[email protected]>
*
*/
Expand All @@ -23,116 +23,115 @@
*/
/// <reference path="Stream.d.ts" />
declare class Class_BufferedStream extends Class_Stream {

/**
* class prop
* class prop
*
*
*
* @brief 查询创建缓存对象时的流对象
*
*
* @readonly
* @type Stream
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's generally no need to explicitly indicate @type of anything that's already given a type annotation in TypeScript. It's not generally picked up well by tooling, and is sometimes inaccurate. For example, the Stream type here is a human nickname for the actual Class_Stream type. And later on String is used instead of string.

*/

stream: Class_Stream

/**
* class prop
* class prop
*
*
*
* @brief 查询和设置当前对象处理文本时的字符集,缺省为 utf-8
*
*
* @type String
*
*
*
*/

charset: string

/**
* class prop
* class prop
*
*
*
* @brief 查询和设置行结尾标识,缺省时,posix:\"\\n\";windows:\"\\r\\n\"
*
*
* @type String
*
*
*
*/

EOL: string



/**
*
*
* @brief BufferedStream 构造函数
* @param stm BufferedStream 的二进制基础流对象
*
*
*
*
*
*
*/
constructor(stm: Class_Stream);

/**
*
*
* @brief 读取指定字符的文本
* @param size 指定读取的文本字符个数,以 utf8 或者指定的编码字节数为准
* @return 返回读取的文本字符串,若无数据可读,或者连接中断,则返回 null
*
*
*
*
* @async
*/
readText(size: number): string;

/**
*
*
* @brief 读取一行文本,行结尾标识基于 EOL 属性的设置,缺省时,posix:\"\\n\";windows:\"\\r\\n\"
* @param maxlen 指定此次读取的最大字符串,以 utf8 编码字节数为准,缺省不限制字符数
* @return 返回读取的文本字符串,若无数据可读,或者连接中断,则返回 null
*
*
*
*
* @async
*/
readLine(maxlen?: number/** = -1*/): string;

/**
*
*
* @brief 以数组方式读取一组文本行,行结尾标识基于 EOL 属性的设置,缺省时,posix:\"\\n\";windows:\"\\r\\n\"
* @param maxlines 指定此次读取的最大行数,缺省读取全部文本行
* @return 返回读取的文本行数组,若无数据可读,或者连接中断,空数组
*
*
*
*
*
*
*/
readLines(maxlines?: number/** = -1*/): any[];

/**
*
*
* @brief 读取一个文本字符串,以指定的字节为结尾
* @param mk 指定结尾的字符串
* @param maxlen 指定此次读取的最大字符串,以 utf8 编码字节数为准,缺省不限制字符数
* @return 返回读取的文本字符串,若无数据可读,或者连接中断,则返回 null
*
*
*
*
* @async
*/
readUntil(mk: string, maxlen?: number/** = -1*/): string;

/**
*
*
* @brief 写入一个字符串
* @param txt 指定写入的字符串
*
*
*
*
* @async
*/
writeText(txt: string): void;

/**
*
*
* @brief 写入一个字符串,并写入换行符
* @param txt 指定写入的字符串
*
*
*
*
* @async
*/
writeLine(txt: string): void;
Expand Down
100 changes: 50 additions & 50 deletions types/fibjs/declare/Cipher.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* *
***************************************************************************/

/**
/**
* @author Richard <[email protected]>
*
*/
Expand All @@ -23,121 +23,121 @@
*/

declare class Class_Cipher extends Class__object {

/**
* class prop
* class prop
*
*
*
* @brief 返回当前算法名称
*
*
* @readonly
* @type String
*
*/

name: string

/**
* class prop
* class prop
*
*
*
* @brief 返回当前算法密码长度,以位为单位
*
*
* @readonly
* @type Integer
* @note Assumed to be an integer.
*/

keySize: number

/**
* class prop
* class prop
*
*
*
* @brief 返回当前算法初始向量长度,以字节为单位
*
*
* @readonly
* @type Integer
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, the @type actually did add useful information (TypeScript doesn't have a way to represent numbers that are only ever integers). So I manually preserved the info as a @note.

* @note Assumed to be an integer.
*/

ivSize: number

/**
* class prop
* class prop
*
*
*
* @brief 返回当前算法数据块长度,以字节为单位
*
*
* @readonly
* @type Integer
* @note Assumed to be an integer.
*/

blockSize: number



/**
*
*
* @brief Cipher 构造函数,仅用于 ARC4 初始化
* @param provider 指定加密算法
* @param key 指定加密解密密码
*
*
*
*
*
*
*/
constructor(provider: number, key: Class_Buffer);

/**
*
*
* @brief Cipher 构造函数
* @param provider 指定加密算法
* @param mode 指定分组密码工作模式
* @param key 指定加密解密密码
*
*
*
*
*
*
*/
constructor(provider: number, mode: number, key: Class_Buffer);

/**
*
*
* @brief Cipher 构造函数
* @param provider 指定加密算法
* @param mode 指定分组密码工作模式
* @param key 指定加密解密密码
* @param iv 指定初始向量
*
*
*
*
*
*
*/
constructor(provider: number, mode: number, key: Class_Buffer, iv: Class_Buffer);

/**
*
*
* @brief 使用填充模式
* @param mode 指定填充模式,缺省为 PADDING_PKCS7
*
*
*
*
*
*
*/
paddingMode(mode: number): void;

/**
*
*
* @brief 使用当前算法密码加密数据
* @param data 指定要加密的数据
* @return 返回加密后的数据
*
*
*
*
* @async
*/
encrypt(data: Class_Buffer): Class_Buffer;

/**
*
*
* @brief 使用当前算法密码解密数据
* @param data 指定要解密的数据
* @return 返回解密后的数据
*
*
*
*
* @async
*/
decrypt(data: Class_Buffer): Class_Buffer;
Expand Down
Loading