Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
31b01cb2
提交
31b01cb2
authored
4月 09, 2015
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix bug in "jdbc:h2:nioMemFS" isRoot() function. Also, the page size was increased to 64 KB.
上级
34f598a3
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
23 行增加
和
6 行删除
+23
-6
CompressLZF.java
h2/src/main/org/h2/compress/CompressLZF.java
+2
-2
FilePathNioMem.java
h2/src/main/org/h2/store/fs/FilePathNioMem.java
+19
-3
TestCompress.java
h2/src/test/org/h2/test/unit/TestCompress.java
+1
-1
TestFileSystem.java
h2/src/test/org/h2/test/unit/TestFileSystem.java
+1
-0
没有找到文件。
h2/src/main/org/h2/compress/CompressLZF.java
浏览文件 @
31b01cb2
...
@@ -259,12 +259,12 @@ public final class CompressLZF implements Compressor {
...
@@ -259,12 +259,12 @@ public final class CompressLZF implements Compressor {
* Compress a number of bytes.
* Compress a number of bytes.
*
*
* @param in the input data
* @param in the input data
* @param inPos the offset at the input buffer
* @param out the output area
* @param out the output area
* @param outPos the offset at the output array
* @param outPos the offset at the output array
* @return the end position
* @return the end position
*/
*/
public
int
compress
(
ByteBuffer
in
,
byte
[]
out
,
int
outPos
)
{
public
int
compress
(
ByteBuffer
in
,
int
inPos
,
byte
[]
out
,
int
outPos
)
{
int
inPos
=
in
.
position
();
int
inLen
=
in
.
capacity
()
-
inPos
;
int
inLen
=
in
.
capacity
()
-
inPos
;
if
(
cachedHashTable
==
null
)
{
if
(
cachedHashTable
==
null
)
{
cachedHashTable
=
new
int
[
HASH_SIZE
];
cachedHashTable
=
new
int
[
HASH_SIZE
];
...
...
h2/src/main/org/h2/store/fs/FilePathNioMem.java
浏览文件 @
31b01cb2
...
@@ -194,7 +194,14 @@ public class FilePathNioMem extends FilePath {
...
@@ -194,7 +194,14 @@ public class FilePathNioMem extends FilePath {
return
name
.
equals
(
getScheme
()
+
":"
);
return
name
.
equals
(
getScheme
()
+
":"
);
}
}
private
static
String
getCanonicalPath
(
String
fileName
)
{
/**
* Get the canonical path of a file (with backslashes replaced with forward
* slashes).
*
* @param fileName the file name
* @return the canonical path
*/
protected
static
String
getCanonicalPath
(
String
fileName
)
{
fileName
=
fileName
.
replace
(
'\\'
,
'/'
);
fileName
=
fileName
.
replace
(
'\\'
,
'/'
);
int
idx
=
fileName
.
indexOf
(
':'
)
+
1
;
int
idx
=
fileName
.
indexOf
(
':'
)
+
1
;
if
(
fileName
.
length
()
>
idx
&&
fileName
.
charAt
(
idx
)
!=
'/'
)
{
if
(
fileName
.
length
()
>
idx
&&
fileName
.
charAt
(
idx
)
!=
'/'
)
{
...
@@ -229,6 +236,13 @@ class FilePathNioMemLZF extends FilePathNioMem {
...
@@ -229,6 +236,13 @@ class FilePathNioMemLZF extends FilePathNioMem {
return
true
;
return
true
;
}
}
@Override
public
FilePathNioMem
getPath
(
String
path
)
{
FilePathNioMemLZF
p
=
new
FilePathNioMemLZF
();
p
.
name
=
getCanonicalPath
(
path
);
return
p
;
}
@Override
@Override
public
String
getScheme
()
{
public
String
getScheme
()
{
return
"nioMemLZF"
;
return
"nioMemLZF"
;
...
@@ -366,7 +380,8 @@ class FileNioMem extends FileBase {
...
@@ -366,7 +380,8 @@ class FileNioMem extends FileBase {
class
FileNioMemData
{
class
FileNioMemData
{
private
static
final
int
CACHE_SIZE
=
8
;
private
static
final
int
CACHE_SIZE
=
8
;
private
static
final
int
BLOCK_SIZE_SHIFT
=
10
;
private
static
final
int
BLOCK_SIZE_SHIFT
=
16
;
private
static
final
int
BLOCK_SIZE
=
1
<<
BLOCK_SIZE_SHIFT
;
private
static
final
int
BLOCK_SIZE
=
1
<<
BLOCK_SIZE_SHIFT
;
private
static
final
int
BLOCK_SIZE_MASK
=
BLOCK_SIZE
-
1
;
private
static
final
int
BLOCK_SIZE_MASK
=
BLOCK_SIZE
-
1
;
private
static
final
CompressLZF
LZF
=
new
CompressLZF
();
private
static
final
CompressLZF
LZF
=
new
CompressLZF
();
...
@@ -508,6 +523,7 @@ class FileNioMemData {
...
@@ -508,6 +523,7 @@ class FileNioMemData {
ByteBuffer
out
=
ByteBuffer
.
allocateDirect
(
BLOCK_SIZE
);
ByteBuffer
out
=
ByteBuffer
.
allocateDirect
(
BLOCK_SIZE
);
if
(
d
!=
COMPRESSED_EMPTY_BLOCK
)
{
if
(
d
!=
COMPRESSED_EMPTY_BLOCK
)
{
synchronized
(
LZF
)
{
synchronized
(
LZF
)
{
d
.
position
(
0
);
CompressLZF
.
expand
(
d
,
out
);
CompressLZF
.
expand
(
d
,
out
);
}
}
}
}
...
@@ -523,7 +539,7 @@ class FileNioMemData {
...
@@ -523,7 +539,7 @@ class FileNioMemData {
static
void
compress
(
ByteBuffer
[]
data
,
int
page
)
{
static
void
compress
(
ByteBuffer
[]
data
,
int
page
)
{
ByteBuffer
d
=
data
[
page
];
ByteBuffer
d
=
data
[
page
];
synchronized
(
LZF
)
{
synchronized
(
LZF
)
{
int
len
=
LZF
.
compress
(
d
,
BUFFER
,
0
);
int
len
=
LZF
.
compress
(
d
,
0
,
BUFFER
,
0
);
d
=
ByteBuffer
.
allocateDirect
(
len
);
d
=
ByteBuffer
.
allocateDirect
(
len
);
d
.
put
(
BUFFER
,
0
,
len
);
d
.
put
(
BUFFER
,
0
,
len
);
data
[
page
]
=
d
;
data
[
page
]
=
d
;
...
...
h2/src/test/org/h2/test/unit/TestCompress.java
浏览文件 @
31b01cb2
...
@@ -308,7 +308,7 @@ public class TestCompress extends TestBase {
...
@@ -308,7 +308,7 @@ public class TestCompress extends TestBase {
}
}
ByteBuffer
buff
=
ByteBuffer
.
wrap
(
b
);
ByteBuffer
buff
=
ByteBuffer
.
wrap
(
b
);
byte
[]
temp
=
new
byte
[
100
+
b
.
length
*
2
];
byte
[]
temp
=
new
byte
[
100
+
b
.
length
*
2
];
int
compLen
=
comp
.
compress
(
buff
,
temp
,
0
);
int
compLen
=
comp
.
compress
(
buff
,
0
,
temp
,
0
);
ByteBuffer
test
=
ByteBuffer
.
wrap
(
temp
,
0
,
compLen
);
ByteBuffer
test
=
ByteBuffer
.
wrap
(
temp
,
0
,
compLen
);
byte
[]
exp
=
new
byte
[
b
.
length
];
byte
[]
exp
=
new
byte
[
b
.
length
];
CompressLZF
.
expand
(
test
,
ByteBuffer
.
wrap
(
exp
));
CompressLZF
.
expand
(
test
,
ByteBuffer
.
wrap
(
exp
));
...
...
h2/src/test/org/h2/test/unit/TestFileSystem.java
浏览文件 @
31b01cb2
...
@@ -525,6 +525,7 @@ public class TestFileSystem extends TestBase {
...
@@ -525,6 +525,7 @@ public class TestFileSystem extends TestBase {
FileUtils
.
delete
(
s
);
FileUtils
.
delete
(
s
);
}
}
FileUtils
.
createDirectories
(
fsBase
+
"/test"
);
FileUtils
.
createDirectories
(
fsBase
+
"/test"
);
assertTrue
(
FileUtils
.
exists
(
fsBase
));
FileUtils
.
delete
(
fsBase
+
"/test"
);
FileUtils
.
delete
(
fsBase
+
"/test"
);
FileUtils
.
delete
(
fsBase
+
"/test2"
);
FileUtils
.
delete
(
fsBase
+
"/test2"
);
assertTrue
(
FileUtils
.
createFile
(
fsBase
+
"/test"
));
assertTrue
(
FileUtils
.
createFile
(
fsBase
+
"/test"
));
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论