提交 501228f1 authored 作者: Thomas Mueller's avatar Thomas Mueller

The RunScript tool and SQL statement did not work with the compression method LZF.

上级 11679d44
......@@ -71,7 +71,6 @@ public class LZFInputStream extends InputStream {
private int readInt() throws IOException {
int x = in.read();
if (x < 0) {
close();
decompress = null;
return 0;
}
......
......@@ -8,6 +8,8 @@ package org.h2.test.unit;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Random;
......@@ -31,6 +33,7 @@ public class TestStreams extends TestBase {
public void test() throws IOException {
testLZFStreams();
testLZFStreamClose();
}
private byte[] getRandomBytes(Random random) {
......@@ -48,6 +51,18 @@ public class TestStreams extends TestBase {
return buffer;
}
private void testLZFStreamClose() throws IOException {
String fileName = getTestDir("") + "/temp";
LZFOutputStream out = new LZFOutputStream(new FileOutputStream(fileName));
out.write("Hello".getBytes());
out.close();
LZFInputStream in = new LZFInputStream(new FileInputStream(fileName));
byte[] buff = new byte[100];
assertEquals(5, in.read(buff));
in.read();
in.close();
}
private void testLZFStreams() throws IOException {
Random random = new Random(1);
int max = getSize(100, 1000);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论