Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
25dac1a1
D
Docs
项目概览
OpenHarmony
/
Docs
接近 1 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
25dac1a1
编写于
11月 21, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 21, 2022
浏览文件
操作
浏览文件
下载
差异文件
!11557 Modify sample code for containers and buffer
Merge pull request !11557 from 冷昌晶/master
上级
f79f7b53
0859dfe5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
32 deletion
+39
-32
zh-cn/application-dev/reference/apis/js-apis-arraylist.md
zh-cn/application-dev/reference/apis/js-apis-arraylist.md
+24
-24
zh-cn/application-dev/reference/apis/js-apis-buffer.md
zh-cn/application-dev/reference/apis/js-apis-buffer.md
+14
-7
zh-cn/application-dev/reference/apis/js-apis-linkedlist.md
zh-cn/application-dev/reference/apis/js-apis-linkedlist.md
+1
-1
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-arraylist.md
浏览文件 @
25dac1a1
...
@@ -99,7 +99,7 @@ add(element: T): boolean
...
@@ -99,7 +99,7 @@ add(element: T): boolean
let
result3
=
arrayList
.
add
(
c
);
let
result3
=
arrayList
.
add
(
c
);
let
result4
=
arrayList
.
add
(
false
);
let
result4
=
arrayList
.
add
(
false
);
try
{
try
{
array
l
ist
.
add
.
bind
({},
"
b
"
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
array
L
ist
.
add
.
bind
({},
"
b
"
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
@@ -137,7 +137,7 @@ arrayList.insert("A", 0);
...
@@ -137,7 +137,7 @@ arrayList.insert("A", 0);
arrayList
.
insert
(
0
,
1
);
arrayList
.
insert
(
0
,
1
);
arrayList
.
insert
(
true
,
2
);
arrayList
.
insert
(
true
,
2
);
try
{
try
{
array
l
ist
.
insert
.
bind
({},
1
,
2
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
array
L
ist
.
insert
.
bind
({},
1
,
2
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
@@ -189,7 +189,7 @@ let result = arrayList.has("squirrel");
...
@@ -189,7 +189,7 @@ let result = arrayList.has("squirrel");
arrayList
.
add
(
"
squirrel
"
);
arrayList
.
add
(
"
squirrel
"
);
let
result1
=
arrayList
.
has
(
"
squirrel
"
);
let
result1
=
arrayList
.
has
(
"
squirrel
"
);
try
{
try
{
array
l
ist
.
has
.
bind
({},
"
squirrel
"
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
array
L
ist
.
has
.
bind
({},
"
squirrel
"
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
@@ -236,7 +236,7 @@ arrayList.add(2);
...
@@ -236,7 +236,7 @@ arrayList.add(2);
arrayList
.
add
(
4
);
arrayList
.
add
(
4
);
let
result
=
arrayList
.
getIndexOf
(
2
);
let
result
=
arrayList
.
getIndexOf
(
2
);
try
{
try
{
array
l
ist
.
getIndexOf
.
bind
({},
2
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
array
L
ist
.
getIndexOf
.
bind
({},
2
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
@@ -283,7 +283,7 @@ arrayList.add(2);
...
@@ -283,7 +283,7 @@ arrayList.add(2);
arrayList
.
add
(
4
);
arrayList
.
add
(
4
);
let
result
=
arrayList
.
getLastIndexOf
(
2
);
let
result
=
arrayList
.
getLastIndexOf
(
2
);
try
{
try
{
array
l
ist
.
getLastIndexOf
.
bind
({},
2
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
array
L
ist
.
getLastIndexOf
.
bind
({},
2
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
@@ -329,17 +329,17 @@ arrayList.add(2);
...
@@ -329,17 +329,17 @@ arrayList.add(2);
arrayList
.
add
(
4
);
arrayList
.
add
(
4
);
let
result
=
arrayList
.
removeByIndex
(
2
);
let
result
=
arrayList
.
removeByIndex
(
2
);
try
{
try
{
array
l
ist
.
removeByIndex
.
bind
({},
2
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
array
L
ist
.
removeByIndex
.
bind
({},
2
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
try
{
try
{
array
l
ist
.
removeByIndex
(
"
a
"
);
// 测试类型异常
array
L
ist
.
removeByIndex
(
"
a
"
);
// 测试类型异常
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
try
{
try
{
array
l
ist
.
removeByIndex
(
8
);
// 测试越界异常
array
L
ist
.
removeByIndex
(
8
);
// 测试越界异常
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
@@ -383,7 +383,7 @@ arrayList.add(5);
...
@@ -383,7 +383,7 @@ arrayList.add(5);
arrayList
.
add
(
4
);
arrayList
.
add
(
4
);
let
result
=
arrayList
.
remove
(
2
);
let
result
=
arrayList
.
remove
(
2
);
try
{
try
{
array
l
ist
.
remove
.
bind
({},
2
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
array
L
ist
.
remove
.
bind
({},
2
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
@@ -423,12 +423,12 @@ arrayList.add(5);
...
@@ -423,12 +423,12 @@ arrayList.add(5);
arrayList
.
add
(
4
);
arrayList
.
add
(
4
);
arrayList
.
removeByRange
(
2
,
4
);
arrayList
.
removeByRange
(
2
,
4
);
try
{
try
{
array
l
ist
.
removeByRange
.
bind
({},
2
,
4
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
array
L
ist
.
removeByRange
.
bind
({},
2
,
4
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
try
{
try
{
array
l
ist
.
removeByRange
(
8
,
4
);
// 测试越界异常
array
L
ist
.
removeByRange
(
8
,
4
);
// 测试越界异常
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
@@ -481,7 +481,7 @@ arrayList.replaceAllElements((value: number, index: number) => {
...
@@ -481,7 +481,7 @@ arrayList.replaceAllElements((value: number, index: number) => {
return
value
=
value
-
2
;
return
value
=
value
-
2
;
});
});
try
{
try
{
array
l
ist
.
replaceAllElements
.
bind
({},
(
value
:
number
,
index
:
number
)
=>
{
array
L
ist
.
replaceAllElements
.
bind
({},
(
value
:
number
,
index
:
number
)
=>
{
return
value
=
2
*
value
;
return
value
=
2
*
value
;
})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
...
@@ -533,7 +533,7 @@ arrayList.forEach((value, index) => {
...
@@ -533,7 +533,7 @@ arrayList.forEach((value, index) => {
console
.
log
(
`value:
${
value
}
`
,
index
);
console
.
log
(
`value:
${
value
}
`
,
index
);
});
});
try
{
try
{
array
l
ist
.
forEach
.
bind
({},
(
value
,
index
)
=>
{
array
L
ist
.
forEach
.
bind
({},
(
value
,
index
)
=>
{
console
.
log
(
`value:
${
value
}
`
,
index
);
console
.
log
(
`value:
${
value
}
`
,
index
);
})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
...
@@ -582,7 +582,7 @@ arrayList.sort((a: number, b: number) => a - b);
...
@@ -582,7 +582,7 @@ arrayList.sort((a: number, b: number) => a - b);
arrayList
.
sort
((
a
:
number
,
b
:
number
)
=>
b
-
a
);
arrayList
.
sort
((
a
:
number
,
b
:
number
)
=>
b
-
a
);
arrayList
.
sort
();
arrayList
.
sort
();
try
{
try
{
array
l
ist
.
sort
.
bind
({})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
array
L
ist
.
sort
.
bind
({})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
@@ -630,12 +630,12 @@ let result1 = arrayList.subArrayList(2, 4);
...
@@ -630,12 +630,12 @@ let result1 = arrayList.subArrayList(2, 4);
let
result2
=
arrayList
.
subArrayList
(
4
,
3
);
let
result2
=
arrayList
.
subArrayList
(
4
,
3
);
let
result3
=
arrayList
.
subArrayList
(
2
,
6
);
let
result3
=
arrayList
.
subArrayList
(
2
,
6
);
try
{
try
{
array
l
ist
.
subArrayList
.
bind
({},
2
,
4
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
array
L
ist
.
subArrayList
.
bind
({},
2
,
4
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
try
{
try
{
array
l
ist
.
subArrayList
(
6
,
4
);
array
L
ist
.
subArrayList
(
6
,
4
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
@@ -667,7 +667,7 @@ arrayList.add(5);
...
@@ -667,7 +667,7 @@ arrayList.add(5);
arrayList
.
add
(
4
);
arrayList
.
add
(
4
);
arrayList
.
clear
();
arrayList
.
clear
();
try
{
try
{
array
l
ist
.
clear
.
bind
({})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
array
L
ist
.
clear
.
bind
({})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
@@ -706,7 +706,7 @@ arrayList.add(5);
...
@@ -706,7 +706,7 @@ arrayList.add(5);
arrayList
.
add
(
4
);
arrayList
.
add
(
4
);
let
result
=
arrayList
.
clone
();
let
result
=
arrayList
.
clone
();
try
{
try
{
array
l
ist
.
clone
.
bind
({})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
array
L
ist
.
clone
.
bind
({})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
@@ -744,7 +744,7 @@ arrayList.add(5);
...
@@ -744,7 +744,7 @@ arrayList.add(5);
arrayList
.
add
(
4
);
arrayList
.
add
(
4
);
let
result
=
arrayList
.
getCapacity
();
let
result
=
arrayList
.
getCapacity
();
try
{
try
{
array
l
ist
.
getCapacity
.
bind
({})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
array
L
ist
.
getCapacity
.
bind
({})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
@@ -782,7 +782,7 @@ arrayList.add(5);
...
@@ -782,7 +782,7 @@ arrayList.add(5);
arrayList
.
add
(
4
);
arrayList
.
add
(
4
);
let
result
=
arrayList
.
convertToArray
();
let
result
=
arrayList
.
convertToArray
();
try
{
try
{
array
l
ist
.
convertToArray
.
bind
({})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
array
L
ist
.
convertToArray
.
bind
({})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
@@ -820,7 +820,7 @@ arrayList.add(5);
...
@@ -820,7 +820,7 @@ arrayList.add(5);
arrayList
.
add
(
4
);
arrayList
.
add
(
4
);
let
result
=
arrayList
.
isEmpty
();
let
result
=
arrayList
.
isEmpty
();
try
{
try
{
array
l
ist
.
isEmpty
.
bind
({})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
array
L
ist
.
isEmpty
.
bind
({})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
@@ -859,7 +859,7 @@ arrayList.add(4);
...
@@ -859,7 +859,7 @@ arrayList.add(4);
arrayList
.
increaseCapacityTo
(
2
);
arrayList
.
increaseCapacityTo
(
2
);
arrayList
.
increaseCapacityTo
(
8
);
arrayList
.
increaseCapacityTo
(
8
);
try
{
try
{
array
l
ist
.
increaseCapacityTo
.
bind
({},
5
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
array
L
ist
.
increaseCapacityTo
.
bind
({},
5
)();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
@@ -891,7 +891,7 @@ arrayList.add(5);
...
@@ -891,7 +891,7 @@ arrayList.add(5);
arrayList
.
add
(
4
);
arrayList
.
add
(
4
);
arrayList
.
trimToCurrentLength
();
arrayList
.
trimToCurrentLength
();
try
{
try
{
array
l
ist
.
trimToCurrentLength
.
bind
({})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
array
L
ist
.
trimToCurrentLength
.
bind
({})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
@@ -941,7 +941,7 @@ while(temp != undefined) {
...
@@ -941,7 +941,7 @@ while(temp != undefined) {
temp
=
iter
.
next
().
value
;
temp
=
iter
.
next
().
value
;
}
}
try
{
try
{
array
l
ist
[
Symbol
.
iterator
].
bind
({})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
array
L
ist
[
Symbol
.
iterator
].
bind
({})();
// bind为JS标准内置对象Function的方法,用于改变this的指向,测试异常捕获
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
...
zh-cn/application-dev/reference/apis/js-apis-buffer.md
浏览文件 @
25dac1a1
...
@@ -371,6 +371,13 @@ import buffer from '@ohos.buffer';
...
@@ -371,6 +371,13 @@ import buffer from '@ohos.buffer';
let
ab
=
new
ArrayBuffer
(
10
);
let
ab
=
new
ArrayBuffer
(
10
);
let
buf
=
buffer
.
from
(
ab
,
0
,
2
);
let
buf
=
buffer
.
from
(
ab
,
0
,
2
);
let
arrayBuffer
=
new
ArrayBuffer
(
5
);
let
array
=
new
Int8Array
(
arrayBuffer
);
array
[
0
]
=
'
1
'
;
array
[
1
]
=
'
2
'
;
array
[
2
]
=
'
3
'
;
array
[
3
]
=
'
4
'
;
array
[
4
]
=
'
5
'
;
try
{
try
{
const
buf
=
buffer
.
from
(
arrayBuffer
,
6
,
1
);
const
buf
=
buffer
.
from
(
arrayBuffer
,
6
,
1
);
}
catch
(
err
)
{
}
catch
(
err
)
{
...
@@ -1644,10 +1651,10 @@ let buf = buffer.from([1, -2]);
...
@@ -1644,10 +1651,10 @@ let buf = buffer.from([1, -2]);
console
.
log
(
buf
.
readUInt8
(
0
).
toString
());
console
.
log
(
buf
.
readUInt8
(
0
).
toString
());
console
.
log
(
buf
.
readUInt8
(
1
).
toString
());
console
.
log
(
buf
.
readUInt8
(
1
).
toString
());
let
buf
=
buffer
.
allocUninitializedFromPool
(
4
);
let
buf
1
=
buffer
.
allocUninitializedFromPool
(
4
);
buf
.
writeUInt8
(
0x42
);
buf
1
.
writeUInt8
(
0x42
);
try
{
try
{
let
ref
=
buf
.
readUInt8
(
4
).
toString
(
16
);
let
ref
=
buf
1
.
readUInt8
(
4
).
toString
(
16
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
"
readUInt8 exception:
"
+
JSON
.
stringify
(
err
));
console
.
log
(
"
readUInt8 exception:
"
+
JSON
.
stringify
(
err
));
}
}
...
@@ -2430,9 +2437,9 @@ import buffer from '@ohos.buffer';
...
@@ -2430,9 +2437,9 @@ import buffer from '@ohos.buffer';
let
buf
=
buffer
.
allocUninitializedFromPool
(
8
);
let
buf
=
buffer
.
allocUninitializedFromPool
(
8
);
buf
.
writeBigUInt64LE
(
0xdecafafecacefade
n
,
0
);
buf
.
writeBigUInt64LE
(
0xdecafafecacefade
n
,
0
);
let
buf
=
buffer
.
allocUninitializedFromPool
(
8
);
let
buf
1
=
buffer
.
allocUninitializedFromPool
(
8
);
try
{
try
{
let
ref
=
buf
.
writeBigUInt64LE
(
0xdecafafecacefade
n
,
1
);
let
ref
=
buf
1
.
writeBigUInt64LE
(
0xdecafafecacefade
n
,
1
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
"
writeBigUInt64LE exception:
"
+
JSON
.
stringify
(
err
));
console
.
log
(
"
writeBigUInt64LE exception:
"
+
JSON
.
stringify
(
err
));
}
}
...
@@ -2522,9 +2529,9 @@ import buffer from '@ohos.buffer';
...
@@ -2522,9 +2529,9 @@ import buffer from '@ohos.buffer';
let
buf
=
buffer
.
allocUninitializedFromPool
(
8
);
let
buf
=
buffer
.
allocUninitializedFromPool
(
8
);
buf
.
writeDoubleLE
(
123.456
,
0
);
buf
.
writeDoubleLE
(
123.456
,
0
);
let
buf
=
buffer
.
allocUninitializedFromPool
(
8
);
let
buf
1
=
buffer
.
allocUninitializedFromPool
(
8
);
try
{
try
{
let
ref
=
buf
.
writeDoubleLE
(
123.456
,
1
);
let
ref
=
buf
1
.
writeDoubleLE
(
123.456
,
1
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
"
writeDoubleLE exception:
"
+
JSON
.
stringify
(
err
));
console
.
log
(
"
writeDoubleLE exception:
"
+
JSON
.
stringify
(
err
));
}
}
...
...
zh-cn/application-dev/reference/apis/js-apis-linkedlist.md
浏览文件 @
25dac1a1
...
@@ -594,7 +594,7 @@ removeFirstFound(element: T): boolean
...
@@ -594,7 +594,7 @@ removeFirstFound(element: T): boolean
```
ts
```
ts
let
linkedList
=
new
LinkedList
();
let
linkedList
=
new
LinkedList
();
try
{
try
{
linkedList
.
removeFirstFound
();
linkedList
.
removeFirstFound
(
4
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
console
.
log
(
`
${
err
.
code
}
-
${
err
.
name
}
-
${
err
.
message
}
`
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录