Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Iotdb
提交
327d2b26
I
Iotdb
项目概览
apache
/
Iotdb
大约 1 年 前同步成功
通知
25
Star
3344
Fork
916
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
Iotdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
327d2b26
编写于
7月 17, 2019
作者:
Z
zhutianci
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change String literal "UTF-8" into StandardCharsets.UTF_8
上级
cd83557f
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
14 addition
and
10 deletion
+14
-10
iotdb/src/main/java/org/apache/iotdb/db/exception/builder/ExceptionBuilder.java
...g/apache/iotdb/db/exception/builder/ExceptionBuilder.java
+2
-1
iotdb/src/test/java/org/apache/iotdb/db/exception/ExceptionBuilderTest.java
...a/org/apache/iotdb/db/exception/ExceptionBuilderTest.java
+3
-2
tsfile/src/test/java/org/apache/iotdb/tsfile/compress/CompressTest.java
...t/java/org/apache/iotdb/tsfile/compress/CompressTest.java
+7
-6
tsfile/src/test/java/org/apache/iotdb/tsfile/compress/SnappyTest.java
...est/java/org/apache/iotdb/tsfile/compress/SnappyTest.java
+2
-1
未找到文件。
iotdb/src/main/java/org/apache/iotdb/db/exception/builder/ExceptionBuilder.java
浏览文件 @
327d2b26
...
...
@@ -24,6 +24,7 @@ import java.io.FileInputStream;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Properties
;
import
org.apache.iotdb.db.conf.IoTDBConfig
;
import
org.apache.iotdb.db.conf.IoTDBConstant
;
...
...
@@ -60,7 +61,7 @@ public class ExceptionBuilder {
*/
public
void
loadInfo
(
String
filePath
)
{
try
(
InputStream
in
=
new
BufferedInputStream
(
new
FileInputStream
(
filePath
))){
properties
.
load
(
new
InputStreamReader
(
in
,
"utf-8"
));
properties
.
load
(
new
InputStreamReader
(
in
,
StandardCharsets
.
UTF_8
));
}
catch
(
IOException
e
)
{
logger
.
error
(
"Read file error. File does not exist or file is broken. "
...
...
iotdb/src/test/java/org/apache/iotdb/db/exception/ExceptionBuilderTest.java
浏览文件 @
327d2b26
...
...
@@ -24,6 +24,7 @@ import java.io.File;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStreamWriter
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Properties
;
import
org.apache.iotdb.db.exception.builder.ExceptionBuilder
;
import
org.junit.After
;
...
...
@@ -49,7 +50,7 @@ public class ExceptionBuilderTest {
prop
.
setProperty
(
"20130"
,
"Statement not prepared"
);
prop
.
setProperty
(
"20220"
,
"Fail to connect"
);
prop
.
store
(
new
OutputStreamWriter
(
out1
,
"utf-8"
),
"english version"
);
prop
.
store
(
new
OutputStreamWriter
(
out1
,
StandardCharsets
.
UTF_8
),
"english version"
);
out2
=
new
FileOutputStream
(
"err_info_cn.properties"
,
true
);
prop
.
setProperty
(
"20000"
,
"未知错误"
);
...
...
@@ -62,7 +63,7 @@ public class ExceptionBuilderTest {
prop
.
setProperty
(
"20130"
,
"语句未就绪"
);
prop
.
setProperty
(
"20220"
,
"连接失败"
);
prop
.
store
(
new
OutputStreamWriter
(
out2
,
"utf-8"
),
"chinese version"
);
prop
.
store
(
new
OutputStreamWriter
(
out2
,
StandardCharsets
.
UTF_8
),
"chinese version"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
...
...
tsfile/src/test/java/org/apache/iotdb/tsfile/compress/CompressTest.java
浏览文件 @
327d2b26
...
...
@@ -21,6 +21,7 @@ package org.apache.iotdb.tsfile.compress;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Arrays
;
import
org.apache.iotdb.tsfile.utils.PublicBAOS
;
import
org.junit.After
;
...
...
@@ -49,35 +50,35 @@ public class CompressTest {
@Test
public
void
snappyCompressorTest1
()
throws
IOException
{
PublicBAOS
out
=
new
PublicBAOS
();
out
.
write
(
inputString
.
getBytes
(
"UTF-8"
));
out
.
write
(
inputString
.
getBytes
(
StandardCharsets
.
UTF_8
));
ICompressor
.
SnappyCompressor
compressor
=
new
ICompressor
.
SnappyCompressor
();
IUnCompressor
.
SnappyUnCompressor
unCompressor
=
new
IUnCompressor
.
SnappyUnCompressor
();
byte
[]
compressed
=
compressor
.
compress
(
out
.
getBuf
());
byte
[]
uncompressed
=
unCompressor
.
uncompress
(
compressed
);
String
result
=
new
String
(
uncompressed
,
"UTF-8"
);
String
result
=
new
String
(
uncompressed
,
StandardCharsets
.
UTF_8
);
assertEquals
(
inputString
,
result
);
}
@Test
public
void
snappyCompressorTest2
()
throws
IOException
{
PublicBAOS
out
=
new
PublicBAOS
();
out
.
write
(
inputString
.
getBytes
(
"UTF-8"
));
out
.
write
(
inputString
.
getBytes
(
StandardCharsets
.
UTF_8
));
ICompressor
.
SnappyCompressor
compressor
=
new
ICompressor
.
SnappyCompressor
();
IUnCompressor
.
SnappyUnCompressor
unCompressor
=
new
IUnCompressor
.
SnappyUnCompressor
();
byte
[]
compressed
=
new
byte
[
compressor
.
getMaxBytesForCompression
(
out
.
size
())];
int
size
=
compressor
.
compress
(
out
.
getBuf
(),
0
,
out
.
size
(),
compressed
);
byte
[]
bytes
=
Arrays
.
copyOfRange
(
compressed
,
0
,
size
);
byte
[]
uncompressed
=
unCompressor
.
uncompress
(
bytes
);
String
result
=
new
String
(
uncompressed
,
"UTF-8"
);
String
result
=
new
String
(
uncompressed
,
StandardCharsets
.
UTF_8
);
assertEquals
(
inputString
,
result
);
}
@Test
public
void
snappyTest
()
throws
IOException
{
byte
[]
compressed
=
Snappy
.
compress
(
inputString
.
getBytes
(
"UTF-8"
));
byte
[]
compressed
=
Snappy
.
compress
(
inputString
.
getBytes
(
StandardCharsets
.
UTF_8
));
byte
[]
uncompressed
=
Snappy
.
uncompress
(
compressed
);
String
result
=
new
String
(
uncompressed
,
"UTF-8"
);
String
result
=
new
String
(
uncompressed
,
StandardCharsets
.
UTF_8
);
assertEquals
(
inputString
,
result
);
}
...
...
tsfile/src/test/java/org/apache/iotdb/tsfile/compress/SnappyTest.java
浏览文件 @
327d2b26
...
...
@@ -20,6 +20,7 @@ package org.apache.iotdb.tsfile.compress;
import
java.io.IOException
;
import
java.nio.ByteBuffer
;
import
java.nio.charset.StandardCharsets
;
import
java.util.concurrent.ThreadLocalRandom
;
import
org.apache.iotdb.tsfile.utils.ReadWriteIOUtils
;
import
org.junit.After
;
...
...
@@ -51,7 +52,7 @@ public class SnappyTest {
@Test
public
void
testBytes
()
throws
IOException
{
String
input
=
randomString
(
50000
);
byte
[]
uncom
=
input
.
getBytes
(
"UTF-8"
);
byte
[]
uncom
=
input
.
getBytes
(
StandardCharsets
.
UTF_8
);
long
time
=
System
.
currentTimeMillis
();
byte
[]
compressed
=
Snappy
.
compress
(
uncom
);
System
.
out
.
println
(
"compression time cost:"
+
(
System
.
currentTimeMillis
()
-
time
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录