From 8db7d21f7885eaccffac4415e6bf750020dcc91b Mon Sep 17 00:00:00 2001 From: lifansheng Date: Sun, 26 Sep 2021 20:25:53 +0800 Subject: [PATCH] Signed-off-by: lifansheng On branch OpenHarmony-3.0-LTS Your branch is up to date with 'origin/OpenHarmony-3.0-LTS'. Changes to be committed: modified: api/@ohos.process.d.ts modified: api/@ohos.url.d.ts modified: api/@ohos.util.d.ts --- api/@ohos.process.d.ts | 285 ++++++++++++++++++++++++++++++++--- api/@ohos.url.d.ts | 334 +++++++++++++++++++++++++++++------------ api/@ohos.util.d.ts | 162 +++++++++++++++----- 3 files changed, 625 insertions(+), 156 deletions(-) diff --git a/api/@ohos.process.d.ts b/api/@ohos.process.d.ts index 845c97fe98..b3305c41fe 100644 --- a/api/@ohos.process.d.ts +++ b/api/@ohos.process.d.ts @@ -13,68 +13,309 @@ * limitations under the License. */ +/** + * The process is mainly used to obtain the relevant ID of the process, obtain and modify + * the working directory of the process, exit and close the process. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @devices phone, tablet + * @import import url from '@ohos.process'; + * @permission N/A + */ declare namespace process { export interface ChildProcess { + /** + * return pid is the pid of the current process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the pid of the current process. + */ readonly pid: number; + + /** + * return ppid is the pid of the current child process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the pid of the current child process. + */ readonly ppid: number; + + /** + * return exitCode is the exit code of the current child process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the exit code of the current child process. + */ readonly exitCode: number; + + /** + * return boolean is whether the current process signal is sent successfully + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return whether the current process signal is sent successfully. + */ readonly killed: boolean; + /** + * return 'number' is the targer process exit code + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the targer process exit code. + */ wait(): Promise; + /** - * Buffer the stdout until EOF and return it as 'Uint8Array' + * return it as 'Uint8Array' of the stdout until EOF + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return subprocess standard outpute. */ getOutput(): Promise; + /** - * Buffer the stderr until EOF and return it as 'Uint8Array' + * return it as 'Uint8Array of the stderr until EOF + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return subprocess standard error output. */ getErrorOutput(): Promise; + /** * close the target process + * @since 7 + * @sysCap SystemCapability.CCRuntime */ close(): void; + /** * send a signal to process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param signal number or string represents the signal sent. */ - kill(signo: number): void; + kill(signal: number | string): void; } + + /** + * returns the numeric valid group ID of the process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the numeric valid group ID of the process. + */ + readonly getEgid: number; + /** - * spawns a new ChildProcess to run the command + * return the numeric valid user identity of the process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the numeric valid user identity of the process. */ - function runCmd(command: string, options?: RunOptions): ChildProcess; + readonly getEuid: number; - function getPid(): number; - function getPpid(): number; + /** + * returns the numeric group id of the process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the numeric group if of the process. + */ + readonly getGid: number /** - *abort current process - *@return void + * returns the digital user id of the process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the digital user id of the process. + */ + readonly getUid: number; + + /** + * return an array with supplementary group id + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return an array with supplementary group id. + */ + readonly getGroups: number[]; + + /** + * return pid is The pid of the current process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return The pid of the current process. + */ + readonly getPid: number; + + /** + * return ppid is The pid of the current child process + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return The pid of the current child processs. + */ + readonly getPpid: number; + + /** + * Returns the tid of the current thread. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return the tid of the current thread. + */ + function getTid(): number; + + /** + * Returns a boolean whether the process is isolated. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return boolean whether the process is isolated. + */ + function isIsolatedProcess(): boolean; + + /** + * Returns a boolean whether the specified uid belongs to a particular application. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param v An id. + * @return return a boolean whether the specified uid belongs to a particular application. + */ + function isAppUid(v: number): boolean; + + /** + * Returns a boolean whether the process is running in a 64-bit environment. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return return a boolean whether the process is running in a 64-bit environment. + */ + function is64Bit(): boolean; + + /** + * Returns the uid based on the specified user name. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param v Process name. + * @return return the uid based on the specified user name. + */ + function getUidForName(v: string): number; + + /** + * Returns the thread priority based on the specified tid. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param v The tid of the process. + * @return Return the thread priority based on the specified tid. + */ + function getThreadPriority(v: number): number; + + /** + * Returns the elapsed real time (in milliseconds) taken from the start of the system to the start of the process. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Return the start of the system to the start of the process. + */ + function getStartRealtime(): number; + + /** + * Returns cpu cores available for the current process on a multi-core device. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Return cpu cores available for the current process on a multi-core device. + */ + function getAvailableCores​(): number[]; + + /** + * Returns the cpu time (in milliseconds) from the time when the process starts to the current time. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Return the cpu time (in milliseconds) from the time when the process starts to the current time. + */ + function getPastCpuTime(): number; + + /** + * Returns the system configuration at runtime. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param name Parameters defined by the system configuration. + * @return Return the system configuration at runtime. + */ + function getSystemConfig(name: number): number; + + type EventListener = (evt: Object) => void; + /** + * Return a child process object and spawns a new ChildProcess to run the command + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param command string of the shell commands executed by the child process. + * @param options This is an object. The object contains three parameters. Timeout is the running time of the child + * process, killSignal is the signal sent when the child process reaches timeout, and maxBuffer is the size of the + * maximum buffer area for standard input and output. + * @return Return a child process object. + */ + function runCmd(command: string, + options?: { timeout : number, killSignal : number | string, maxBuffer : number }): ChildProcess; + + /** + * Abort current process + * @since 7 + * @sysCap SystemCapability.CCRuntime */ function abort(): void; + /** + * Register for an event + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param type Indicates the type of event registered. + * @param listener Represents the registered event function + */ function on(type: string, listener: EventListener): void; - function exit(code?:number): void; /** - *get current work directory; + * Remove registered event + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param type Remove the type of registered event. + * @return Return removed result. + */ + function off(type: string): boolean; + + /** + * Process exit + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param code Process exit code. + */ + function exit(code: number): void; + + /** + * Return the current work directory; + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Return the current work directory. */ function cwd(): string; - + /** - *change current directory - *@param dir + * Change current directory + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param dir The path you want to change. */ function chdir(dir: string): void; - function getEgid(): number; - function getEuid(): number; - - function getGid(): number - function getUid(): number; + /** + * Returns the running time of the system + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Return the running time of the system. + */ function uptime(): number; - function getGroups(): number[]; - function kill(signal?: number, pid?: number): boolean; + /** + * Return whether the signal was sent successfully + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param signal Signal sent. + * @param pid Send signal to target pid. + * @return Return the result of the signal. + */ + function kill(signal: number, pid: number): boolean; } -export default process; \ No newline at end of file +export default process; diff --git a/api/@ohos.url.d.ts b/api/@ohos.url.d.ts index fa3cb00c50..3bf1c4482b 100644 --- a/api/@ohos.url.d.ts +++ b/api/@ohos.url.d.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * -* http://www.apache.org/licenses/LICENSE-2.0 +* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -13,113 +13,257 @@ * limitations under the License. */ -declare class URLSearchParams { - constructor(init ? : string[][] | Record | string | URLSearchParams -}; - -/** Appends a specified key/value pair as a new search parameter. +/** + * The url module provides utilities for URL resolution and parsing. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @devices phone, tablet + * @import import url from '@ohos.url'; + * @permission N/A */ -append(name: string, value : string) : void; -/** Delete the given search parameter and its associated value, - * from the list of all search parameters. - */ -delete(name: string) : void; +declare namespace url { + class URLSearchParams { + /** + * A parameterized constructor used to create an URLSearchParams instance. + * As the input parameter of the constructor function, init supports four types. + * The input parameter is a character string two-dimensional array. + * The input parameter is the object list. + * The input parameter is a character string. + * The input parameter is the URLSearchParams object. + */ + constructor(init?: string[][] | Record | string | URLSearchParams); -/** Returns all the values associated with a given search parameter - * as an array. - */ -getAll(name: string) : string[]; + /** + * Appends a specified key/value pair as a new search parameter. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param name Key name of the search parameter to be inserted. + * @param value Values of search parameters to be inserted. + */ + append(name: string, value: string): void; -/** Returns an iterator allowing to go through all key/value - * pairs contained in this object. - */ -entries() : IterableIterator<[string, string]>; + /** + * Deletes the given search parameter and its associated value,from the list of all search parameters. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param Name of the key-value pair to be deleted. + */ + delete(name: string): void; -/** Allows iteration through all values contained in this object via a callback function. - */ -forEach(callbackfn: (value: string, key : string, parent : this) = > void, thisArg ? : object) : void; + /** + * Returns all key-value pairs associated with a given search parameter as an array. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param Name Specifies the name of a key value. + * @return string[] Returns all key-value pairs with the specified name. + */ + getAll(name: string): string[]; -/** Returns the first value associated to the given search parameter. - */ -get(name: string) : string | null; + /** + * Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. + * The first item of Array is name, and the second item of Array is value. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns an iterator for ES6. + */ + entries(): IterableIterator<[string, string]>; -/** Returns a Boolean that indicates whether a parameter with the - * specified name exists. - */ -has(name: string) : boolean; + /** + * Callback functions are used to traverse key-value pairs on the URLSearchParams instance object. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param value Current traversal key value. + * @param key Indicates the name of the key that is traversed. + * @param searchParams The instance object that is currently calling the forEach method. + */ + forEach(callbackfn: (value: string, key: string, searchParams: this) => void): void; -/**Sets the value associated with a given search parameter to the - * given value.If there were several matching values, this methods - * deletes the others. If the search parameter doesn't exist, this - * methods creates it. - */ -set(name: string, value : string) : void; + /** + * Returns the first value associated to the given search parameter. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param name Specifies the name of a key-value pair. + * @return Returns the first value found by name. If no value is found, null is returned. + */ + get(name: string): string | null; -/** Sort all key/value pairs contained in this object in place and - * return undefined. - */ -sort() : void; + /** + * Returns a Boolean that indicates whether a parameter with the specified name exists. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param name Specifies the name of a key-value pair. + * @return Returns a Boolean value that indicates whether a found + */ + has(name: string): boolean; -/** Returns an iterator allowing to go through all keys contained - * in this object. - */ -keys() :IterableIterator; + /** + * Sets the value associated with a given search parameter to the + * given value. If there were several matching values, this method + * deletes the others. If the search parameter doesn't exist, this + * method creates it. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param name Key name of the parameter to be set. + * @param value Indicates the parameter value to be set. + */ + set(name: string, value: string): void; -/** Returns an iterator allowing to go through all values contained - * in this object. - */ -values() : IterableIterator; + /** + * Sort all key/value pairs contained in this object in place and return undefined. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + sort(): void; + /** + * Returns an iterator allowing to go through all keys contained in this object. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns an ES6 Iterator over the names of each name-value pair. + */ + keys(): IterableIterator; -/** Returns an iterator allowing to go through all key/value - * pairs contained in this object. - */ -[Symbol.iterator]() : IterableIterator<[string, string]>; + /** + * Returns an iterator allowing to go through all values contained in this object. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns an ES6 Iterator over the values of each name-value pair. + */ + values(): IterableIterator; -/** Returns a query string suitable for use in a URL. - */ -toString() :string; -} + /** + * Returns an iterator allowing to go through all key/value + * pairs contained in this object. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. + * The first item of Array is name, and the second item of Array is value. + */ + [Symbol.iterator](): IterableIterator<[string, string]>; -/* web api URL interface */ -declare class URL { - /** constructor of URL - * url:absolute URL string or a relative URL string - * base:base URL string - */ - constructor(url: string, base ? : string | URL); - - /* methods */ - createObjectURL(object: object) : string; - revokeObjectURL(url: string) : void; - toString() : string; - toJSON() : string; - - /* fragment identifier of URL */ -hash: string; - /* domain: port of URL */ -host: string; - /* domain of URL */ -hostname: string; - /* whole URL */ -href: string; - /* contain the origin of the URL, readonly */ - readonly origin : string; - /* password specified before the domain name */ -password: string; - /* an '/' followed by the path of the URL */ -pathname: string; - /* port of the URL */ -port: string; - /* the protocol scheme of the URL, readonly */ -protocol: string; - /* indicating the parameter string of the URL */ -search: string; - /* URLSearchParams object which used to access the individual query parameters */ - readonly searchParams : URLSearchParams; - /* the username before the domain name */ -username: string; -} + /** + * Returns a query string suitable for use in a URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns a search parameter serialized as a string, percent-encoded if necessary. + */ + toString(): string; + } + + class URL { + /** + * URL constructor, which is used to instantiate a URL object. + * url: Absolute or relative input URL to resolve. Base is required if input is relative. + * If input is an absolute value, base ignores the value. + * base: Base URL to parse if input is not absolute. + */ + constructor(url: string, base?: string | URL); + + /** + * Returns the serialized URL as a string. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns the serialized URL as a string. + */ + toString(): string; + + /** + * Returns the serialized URL as a string. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @return Returns the serialized URL as a string. + */ + toJSON(): string; -export {URL, URLSearchParams}; \ No newline at end of file + /** + * Gets and sets the fragment portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + hash: string; + + /** + * Gets and sets the host portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + host: string; + + /** + * Gets and sets the host name portion of the URL,not include the port. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + hostname: string; + + /** + * Gets and sets the serialized URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + href: string; + + /** + * Gets the read-only serialization of the URL's origin. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + readonly origin: string; + + /** + * Gets and sets the password portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + password: string; + + /** + * Gets and sets the path portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + pathname: string; + + /** + * Gets and sets the port portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + port: string; + + /** + * Gets and sets the protocol portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + protocol: string; + + /** + * Gets and sets the serialized query portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + search: string; + + /** + * Gets the URLSearchParams object that represents the URL query parameter. + * This property is read-only, but URLSearchParams provides an object that can be used to change + * the URL instance. To replace the entire query parameter for a URL, use url.searchsetter. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @note Be careful when modifying with .searchParams, because the URLSearchParams + * object uses different rules to determine which characters to + * percent-encode according to the WHATWG specification. + */ + readonly searchParams: URLSearchParams; + + /** + * Gets and sets the username portion of the URL. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ + username: string; + } +} +export default url; \ No newline at end of file diff --git a/api/@ohos.util.d.ts b/api/@ohos.util.d.ts index 8ff27facc7..04ea18e76b 100644 --- a/api/@ohos.util.d.ts +++ b/api/@ohos.util.d.ts @@ -12,66 +12,150 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +/** + * TextDecoder support full encoding in ICU data utf-8 utf-16 iso8859 must support in all device, TextEncoder takes a + * stream of code points as input and emits a stream of UTF-8 bytes, and system help function. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @devices phone, tablet + * @import import util from '@ohos.util'; + * @permission N/A + */ declare namespace util { - /** return a formatted string using the first argument as a printf-like format. */ - /** %s: String will be used to convert all values except BigInt, Object and -0. BigInt values will - be represented with an n and Objects that have no user defined toString function are inspected using - util.inspect() with options { depth: 0, colors: false, compact: 3 }. - %d: Number will be used to convert all values except BigInt and Symbol. - %i: parseInt(value, 10) is used for all values except BigInt and Symbol. - %f: parseFloat(value) is used for all values except Bigint and Symbol. - %j: JSON. Replaced whith the string '[Circular]' if the argument contains circular references. - %o: Object. A string representation of an object with generic JavaScript object formatting. - Similar to util.inspect() with options { showHidden: true, showProxy: true}. This will show the - full object including non-enumerable properties and proxies. - %O: Object. A string representation of an object with generic JavaScript object formatting. - Similar to util.inspect() without options. This will show the full object not including - non-enumerable properties and proxies. - %c: CSS. This specifier is ignored and will skip any CSS passed in. - %%: single percent sign ('%'). This does not consume an argument. - Returns: The formatted string */ + /** + * %s: String will be used to convert all values except BigInt, Object and -0. BigInt values will be represented + * with an n and Objects that have no user defined toString function are inspected using util.inspect() with + * options { depth: 0, colors: false, compact: 3 }. + * %d: Number will be used to convert all values except BigInt and Symbol. + * %i: parseInt(value, 10) is used for all values except BigInt and Symbol. + * %f: parseFloat(value) is used for all values except Bigint and Symbol. + * %j: JSON. Replaced with the string '[Circular]' if the argument contains circular references. + * %o: Object. A string representation of an object with generic JavaScript object formatting.Similar to + * util.inspect() with options { showHidden: true, showProxy: true}. This will show the full object including + * non-enumerable properties and proxies. + * %O: Object. A string representation of an object with generic JavaScript object formatting. + * %O: Object. A string representation of an object with generic JavaScript object formatting.Similar to + * util.inspect() without options. This will show the full object not including non-enumerable properties and + * proxies. + * %c: CSS. This specifier is ignored and will skip any CSS passed in. + * %%: single percent sign ('%'). This does not consume an argument.Returns: The formatted string. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param format styled string + * @param args data to be formatted + * @return Return the character string formatted in a specific format + */ function printf(format: string, ...args: Object[]): string; - - /** return the string name of a system errno*/ + + /** + * Get the string name of the system errno. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param errno the error code generated by an error in the system + * @return return the string name of a system errno + */ function getErrorString(errno: number): string; - - /** Takes an async function (or a function that returns a Promise) and returns a function following the - error-first callback style */ - function callbackWrapper(original: Function): (err: Object, value: Object) => void; - /** Takes a function following the common error-first callback style, i.e taking an (err, value) => ... - callback as the last argument, and return a version that returns promises */ - function promiseWrapper(original: (err: Object, value: Object) => void): Object; + /** + * Takes an async function (or a function that returns a Promise) and returns a function following the + * error-first callback style. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param original asynchronous function + */ + function callbackWrapper(original: Function): (err: Object, value: Object) => void; /** - * encoding name: support full encoding in ICU data utf-8 utf-16 iso8859 must support in all device + * Takes a function following the common error-first callback style, i.e taking an (err, value) => + * callback as the last argument, and return a version that returns promises. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param original asynchronous function + * @return return a version that returns promises */ + function promiseWrapper(original: (err: Object, value: Object) => void): Object; + class TextDecoder { - /** the source encoding's name, lowercased. */ + /** + * the source encoding's name, lowercased. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ readonly encoding: string; - /** Returns `true` if error mode is "fatal", and `false` otherwise. */ + + /** + * Returns `true` if error mode is "fatal", and `false` otherwise. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ readonly fatal: boolean; - /** Returns `true` if ignore BOM flag is set, and `false` otherwise. */ + + /** + * Returns `true` if ignore BOM flag is set, and `false` otherwise. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ readonly ignoreBOM = false; + + /** + * the textEncoder constructor. + * @param 7 + * @sysCap SystemCapability.CCRuntime + * @param encoding decoding format + */ constructor( encoding?: string, options?: { fatal?: boolean; ignoreBOM?: boolean }, ); - /** Returns the result of running encoding's decoder. */ - decode(input?: ArrayBuffer | ArrayBufferView, options?: { stream?: false }): string; + + constructor( + encoding?: string, + options?: { fatal?: boolean; ignoreBOM?: boolean }, + ); + /** + * Returns the result of running encoding's decoder. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param input decoded numbers in accordance with the format + * @return return decoded text + */ + decode(input: Uint8Array, options?: { stream?: false }): string; } - /** - * TextEncoder takes a stream of code points as input and emits a stream of UTF-8 bytes. - */ + class TextEncoder { + /** + * Encoding format. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ readonly encoding = "utf-8"; - + + /** + * the textEncoder constructor. + * @since 7 + * @sysCap SystemCapability.CCRuntime + */ constructor(); - /** Returns the result of encoder. */ + /** + * Returns the result of encoder. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param The string to be encoded. + * @return returns the encoded text. + */ encode(input?: string): Uint8Array; - /** encode string, write the result to dest array */ + /** + * encode string, write the result to dest array. + * @since 7 + * @sysCap SystemCapability.CCRuntime + * @param input The string to be encoded. + * @param dest decoded numbers in accordance with the format + * @return returns Returns the object, where read represents + * the number of characters that have been encoded, and written + * represents the number of bytes occupied by the encoded characters. + */ encodeInto( input: string, dest: Uint8Array, @@ -79,4 +163,4 @@ declare namespace util { } } -export default util; +export default util; \ No newline at end of file -- Gitee