use of org.h2.dev.util.BinaryArithmeticStream.Out in project h2database by h2database.
the class TestStreams method testLZFStreamClose.
private void testLZFStreamClose() throws IOException {
String fileName = getBaseDir() + "/temp";
FileUtils.createDirectories(FileUtils.getParent(fileName));
OutputStream fo = FileUtils.newOutputStream(fileName, false);
LZFOutputStream out = new LZFOutputStream(fo);
out.write("Hello".getBytes());
out.close();
InputStream fi = FileUtils.newInputStream(fileName);
LZFInputStream in = new LZFInputStream(fi);
byte[] buff = new byte[100];
assertEquals(5, in.read(buff));
in.read();
in.close();
FileUtils.delete(getBaseDir() + "/temp");
}
use of org.h2.dev.util.BinaryArithmeticStream.Out in project h2database by h2database.
the class FileReorderWrites method open.
@Override
public FileChannel open(String mode) throws IOException {
InputStream in = newInputStream();
FilePath copy = FilePath.get(getBase().toString() + ".copy");
OutputStream out = copy.newOutputStream(false);
IOUtils.copy(in, out);
in.close();
out.close();
FileChannel base = getBase().open(mode);
FileChannel readBase = copy.open(mode);
return new FileReorderWrites(this, base, readBase);
}
Aggregations