@@ -0,0 +1,2163 @@
+package org.grouplens.lenskit.util.io;%0A%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0Aimport org.junit.rules.TemporaryFolder;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.io.Reader;%0Aimport java.io.Writer;%0A%0Aimport static org.hamcrest.Matchers.equalTo;%0Aimport static org.junit.Assert.assertThat;%0A%0A/**%0A * @author %3Ca href=%22http://www.grouplens.org%22%3EGroupLens Research%3C/a%3E%0A */%0Apublic class LKFileUtilsTest %7B%0A    @Rule%0A    public TemporaryFolder tmpdir = new TemporaryFolder();%0A%0A    @Test%0A    public void testUncompressedFile() throws IOException %7B%0A        File file = tmpdir.newFile(%22uncompressed.txt%22);%0A        Writer out = LKFileUtils.openOutput(file);%0A        try %7B%0A            out.write(%22hello%5Cn%22);%0A        %7D finally %7B%0A            out.close();%0A        %7D%0A%0A        Reader in = LKFileUtils.openInput(file, CompressionMode.NONE);%0A        try %7B%0A            char%5B%5D buffer = new char%5B6%5D;%0A            in.read(buffer);%0A            assertThat(new String(buffer), equalTo(%22hello%5Cn%22));%0A        %7D finally %7B%0A            out.close();%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void testGzipFile() throws IOException %7B%0A        File file = tmpdir.newFile(%22uncompressed.txt.gz%22);%0A        Writer out = LKFileUtils.openOutput(file);%0A        try %7B%0A            out.write(%22hello%5Cn%22);%0A        %7D finally %7B%0A            out.close();%0A        %7D%0A%0A        Reader in = LKFileUtils.openInput(file, CompressionMode.GZIP);%0A        try %7B%0A            char%5B%5D buffer = new char%5B6%5D;%0A            in.read(buffer);%0A            assertThat(new String(buffer), equalTo(%22hello%5Cn%22));%0A        %7D finally %7B%0A            out.close();%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void testXZFile() throws IOException %7B%0A        File file = tmpdir.newFile(%22uncompressed.txt.xz%22);%0A        Writer out = LKFileUtils.openOutput(file);%0A        try %7B%0A            out.write(%22hello%5Cn%22);%0A        %7D finally %7B%0A            out.close();%0A        %7D%0A%0A        Reader in = LKFileUtils.openInput(file, CompressionMode.XZ);%0A        try %7B%0A            char%5B%5D buffer = new char%5B6%5D;%0A            in.read(buffer);%0A            assertThat(new String(buffer), equalTo(%22hello%5Cn%22));%0A        %7D finally %7B%0A            out.close();%0A        %7D%0A    %7D%0A%7D%0A

Test compression support in file utils