Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
e9c2b93e
提交
e9c2b93e
authored
11月 05, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Buffered and unbuffered readers
上级
696ff6f2
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
34 行增加
和
12 行删除
+34
-12
TraceObject.java
h2/src/main/org/h2/message/TraceObject.java
+1
-1
TraceSystem.java
h2/src/main/org/h2/message/TraceSystem.java
+1
-1
ConvertTraceFile.java
h2/src/main/org/h2/tools/ConvertTraceFile.java
+3
-3
Recover.java
h2/src/main/org/h2/tools/Recover.java
+1
-1
Script.java
h2/src/main/org/h2/tools/Script.java
+1
-1
IOUtils.java
h2/src/main/org/h2/util/IOUtils.java
+23
-2
SourceCompiler.java
h2/src/main/org/h2/util/SourceCompiler.java
+1
-1
ValueLobDb.java
h2/src/main/org/h2/value/ValueLobDb.java
+1
-1
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+1
-0
TestReader.java
h2/src/test/org/h2/test/unit/TestReader.java
+1
-1
没有找到文件。
h2/src/main/org/h2/message/TraceObject.java
浏览文件 @
e9c2b93e
...
@@ -388,7 +388,7 @@ public class TraceObject {
...
@@ -388,7 +388,7 @@ public class TraceObject {
synchronized
(
TraceObject
.
class
)
{
synchronized
(
TraceObject
.
class
)
{
// e.printStackTrace();
// e.printStackTrace();
try
{
try
{
Writer
writer
=
IOUtils
.
getWriter
(
IOUtils
.
openFileOutputStream
(
SysProperties
.
LOG_ALL_ERRORS_FILE
,
true
));
Writer
writer
=
IOUtils
.
get
Buffered
Writer
(
IOUtils
.
openFileOutputStream
(
SysProperties
.
LOG_ALL_ERRORS_FILE
,
true
));
PrintWriter
p
=
new
PrintWriter
(
writer
);
PrintWriter
p
=
new
PrintWriter
(
writer
);
e
.
printStackTrace
(
p
);
e
.
printStackTrace
(
p
);
p
.
close
();
p
.
close
();
...
...
h2/src/main/org/h2/message/TraceSystem.java
浏览文件 @
e9c2b93e
...
@@ -282,7 +282,7 @@ public class TraceSystem implements TraceWriter {
...
@@ -282,7 +282,7 @@ public class TraceSystem implements TraceWriter {
// can't be opened
// can't be opened
return
false
;
return
false
;
}
}
fileWriter
=
IOUtils
.
getWriter
(
IOUtils
.
openFileOutputStream
(
fileName
,
true
));
fileWriter
=
IOUtils
.
get
Buffered
Writer
(
IOUtils
.
openFileOutputStream
(
fileName
,
true
));
printWriter
=
new
PrintWriter
(
fileWriter
,
true
);
printWriter
=
new
PrintWriter
(
fileWriter
,
true
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logWritingError
(
e
);
logWritingError
(
e
);
...
...
h2/src/main/org/h2/tools/ConvertTraceFile.java
浏览文件 @
e9c2b93e
...
@@ -110,9 +110,9 @@ public class ConvertTraceFile extends Tool {
...
@@ -110,9 +110,9 @@ public class ConvertTraceFile extends Tool {
* @throws IOException
* @throws IOException
*/
*/
private
void
convertFile
(
String
traceFileName
,
String
javaClassName
,
String
script
)
throws
IOException
{
private
void
convertFile
(
String
traceFileName
,
String
javaClassName
,
String
script
)
throws
IOException
{
LineNumberReader
reader
=
new
LineNumberReader
(
IOUtils
.
getReader
(
IOUtils
.
openFileInputStream
(
traceFileName
)));
LineNumberReader
reader
=
new
LineNumberReader
(
IOUtils
.
get
Buffered
Reader
(
IOUtils
.
openFileInputStream
(
traceFileName
)));
PrintWriter
javaWriter
=
new
PrintWriter
(
IOUtils
.
getWriter
(
IOUtils
.
openFileOutputStream
(
javaClassName
+
".java"
,
false
)));
PrintWriter
javaWriter
=
new
PrintWriter
(
IOUtils
.
get
Buffered
Writer
(
IOUtils
.
openFileOutputStream
(
javaClassName
+
".java"
,
false
)));
PrintWriter
scriptWriter
=
new
PrintWriter
(
IOUtils
.
getWriter
(
IOUtils
.
openFileOutputStream
(
script
,
false
)));
PrintWriter
scriptWriter
=
new
PrintWriter
(
IOUtils
.
get
Buffered
Writer
(
IOUtils
.
openFileOutputStream
(
script
,
false
)));
javaWriter
.
println
(
"import java.io.*;"
);
javaWriter
.
println
(
"import java.io.*;"
);
javaWriter
.
println
(
"import java.sql.*;"
);
javaWriter
.
println
(
"import java.sql.*;"
);
javaWriter
.
println
(
"import java.math.*;"
);
javaWriter
.
println
(
"import java.math.*;"
);
...
...
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
e9c2b93e
...
@@ -246,7 +246,7 @@ public class Recover extends Tool implements DataHandler {
...
@@ -246,7 +246,7 @@ public class Recover extends Tool implements DataHandler {
fileName
=
fileName
.
substring
(
0
,
fileName
.
length
()
-
3
);
fileName
=
fileName
.
substring
(
0
,
fileName
.
length
()
-
3
);
String
outputFile
=
fileName
+
suffix
;
String
outputFile
=
fileName
+
suffix
;
trace
(
"Created file: "
+
outputFile
);
trace
(
"Created file: "
+
outputFile
);
return
new
PrintWriter
(
IOUtils
.
getWriter
(
IOUtils
.
openFileOutputStream
(
outputFile
,
false
)));
return
new
PrintWriter
(
IOUtils
.
get
Buffered
Writer
(
IOUtils
.
openFileOutputStream
(
outputFile
,
false
)));
}
}
private
void
writeDataError
(
PrintWriter
writer
,
String
error
,
byte
[]
data
)
{
private
void
writeDataError
(
PrintWriter
writer
,
String
error
,
byte
[]
data
)
{
...
...
h2/src/main/org/h2/tools/Script.java
浏览文件 @
e9c2b93e
...
@@ -188,7 +188,7 @@ public class Script extends Tool {
...
@@ -188,7 +188,7 @@ public class Script extends Tool {
Statement
stat
=
null
;
Statement
stat
=
null
;
try
{
try
{
stat
=
conn
.
createStatement
();
stat
=
conn
.
createStatement
();
PrintWriter
writer
=
new
PrintWriter
(
IOUtils
.
getWriter
(
o
));
PrintWriter
writer
=
new
PrintWriter
(
IOUtils
.
get
Buffered
Writer
(
o
));
ResultSet
rs
=
stat
.
executeQuery
(
"SCRIPT"
);
ResultSet
rs
=
stat
.
executeQuery
(
"SCRIPT"
);
while
(
rs
.
next
())
{
while
(
rs
.
next
())
{
String
s
=
rs
.
getString
(
1
);
String
s
=
rs
.
getString
(
1
);
...
...
h2/src/main/org/h2/util/IOUtils.java
浏览文件 @
e9c2b93e
...
@@ -338,9 +338,30 @@ public class IOUtils {
...
@@ -338,9 +338,30 @@ public class IOUtils {
return
off
<=
0
?
-
1
:
off
;
return
off
<=
0
?
-
1
:
off
;
}
}
/**
* Create a buffered reader to read from an input stream using the UTF-8
* format. If the input stream is null, this method returns null. The
* InputStreamReader that is used here is not exact, that means it may read
* some additional bytes when buffering.
*
* @param in the input stream or null
* @return the reader
*/
public
static
Reader
getBufferedReader
(
InputStream
in
)
{
try
{
//
return
in
==
null
?
null
:
new
BufferedReader
(
new
InputStreamReader
(
in
,
Constants
.
UTF8
));
}
catch
(
Exception
e
)
{
// UnsupportedEncodingException
throw
DbException
.
convert
(
e
);
}
}
/**
/**
* Create a reader to read from an input stream using the UTF-8 format. If
* Create a reader to read from an input stream using the UTF-8 format. If
* the input stream is null, this method returns null.
* the input stream is null, this method returns null. The InputStreamReader
* that is used here is not exact, that means it may read some additional
* bytes when buffering.
*
*
* @param in the input stream or null
* @param in the input stream or null
* @return the reader
* @return the reader
...
@@ -362,7 +383,7 @@ public class IOUtils {
...
@@ -362,7 +383,7 @@ public class IOUtils {
* @param out the output stream or null
* @param out the output stream or null
* @return the writer
* @return the writer
*/
*/
public
static
Writer
getWriter
(
OutputStream
out
)
{
public
static
Writer
get
Buffered
Writer
(
OutputStream
out
)
{
try
{
try
{
return
out
==
null
?
null
:
new
BufferedWriter
(
new
OutputStreamWriter
(
out
,
Constants
.
UTF8
));
return
out
==
null
?
null
:
new
BufferedWriter
(
new
OutputStreamWriter
(
out
,
Constants
.
UTF8
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
h2/src/main/org/h2/util/SourceCompiler.java
浏览文件 @
e9c2b93e
...
@@ -148,7 +148,7 @@ public class SourceCompiler {
...
@@ -148,7 +148,7 @@ public class SourceCompiler {
File
classFile
=
new
File
(
dir
,
className
+
".class"
);
File
classFile
=
new
File
(
dir
,
className
+
".class"
);
try
{
try
{
OutputStream
f
=
IOUtils
.
openFileOutputStream
(
javaFile
.
getAbsolutePath
(),
false
);
OutputStream
f
=
IOUtils
.
openFileOutputStream
(
javaFile
.
getAbsolutePath
(),
false
);
PrintWriter
out
=
new
PrintWriter
(
IOUtils
.
getWriter
(
f
));
PrintWriter
out
=
new
PrintWriter
(
IOUtils
.
get
Buffered
Writer
(
f
));
classFile
.
delete
();
classFile
.
delete
();
int
endImport
=
source
.
indexOf
(
"@CODE"
);
int
endImport
=
source
.
indexOf
(
"@CODE"
);
String
importCode
=
"import java.util.*;\n"
+
String
importCode
=
"import java.util.*;\n"
+
...
...
h2/src/main/org/h2/value/ValueLobDb.java
浏览文件 @
e9c2b93e
...
@@ -261,7 +261,7 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo
...
@@ -261,7 +261,7 @@ public class ValueLobDb extends Value implements Value.ValueClob, Value.ValueBlo
}
}
public
Reader
getReader
()
{
public
Reader
getReader
()
{
return
IOUtils
.
getReader
(
getInputStream
());
return
IOUtils
.
get
Buffered
Reader
(
getInputStream
());
}
}
public
InputStream
getInputStream
()
{
public
InputStream
getInputStream
()
{
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
e9c2b93e
...
@@ -587,6 +587,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
...
@@ -587,6 +587,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
new
TestCancel
().
runTest
(
this
);
new
TestCancel
().
runTest
(
this
);
new
TestDatabaseEventListener
().
runTest
(
this
);
new
TestDatabaseEventListener
().
runTest
(
this
);
new
TestDriver
().
runTest
(
this
);
new
TestDriver
().
runTest
(
this
);
new
TestLob
().
runTest
(
this
);
new
TestManyJdbcObjects
().
runTest
(
this
);
new
TestManyJdbcObjects
().
runTest
(
this
);
new
TestMetaData
().
runTest
(
this
);
new
TestMetaData
().
runTest
(
this
);
new
TestNativeSQL
().
runTest
(
this
);
new
TestNativeSQL
().
runTest
(
this
);
...
...
h2/src/test/org/h2/test/unit/TestReader.java
浏览文件 @
e9c2b93e
...
@@ -35,7 +35,7 @@ public class TestReader extends TestBase {
...
@@ -35,7 +35,7 @@ public class TestReader extends TestBase {
InputStream
in
=
new
ReaderInputStream
(
r
);
InputStream
in
=
new
ReaderInputStream
(
r
);
byte
[]
buff
=
IOUtils
.
readBytesAndClose
(
in
,
0
);
byte
[]
buff
=
IOUtils
.
readBytesAndClose
(
in
,
0
);
InputStream
in2
=
new
ByteArrayInputStream
(
buff
);
InputStream
in2
=
new
ByteArrayInputStream
(
buff
);
Reader
r2
=
IOUtils
.
getReader
(
in2
);
Reader
r2
=
IOUtils
.
get
Buffered
Reader
(
in2
);
String
s2
=
IOUtils
.
readStringAndClose
(
r2
,
Integer
.
MAX_VALUE
);
String
s2
=
IOUtils
.
readStringAndClose
(
r2
,
Integer
.
MAX_VALUE
);
assertEquals
(
s
,
s2
);
assertEquals
(
s
,
s2
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论