@Test public void autoGUnzippedStreamForGZippedFileShouldBeReadableInClear() throws IOException { InputStream gzippedStream = streamFor("/sample_text.txt.gz"); assertThat(toUtf8String(gzippedStream), is(not(HELLO_WORLD))); InputStream in = InputStreams.autoGUnzip(streamFor("/sample_text.txt.gz")); assertThat(toUtf8String(in), is(HELLO_WORLD)); }
@Test public void bufferedShouldWrapTheProvidedInputStreamInBufferedInputStream() { InputStream in = new ByteArrayInputStream(HELLO_WORLD.getBytes(UTF_8)); assertThat(in, is(not(instanceOf(BufferedInputStream.class)))); assertThat(InputStreams.buffered(in), is(instanceOf(BufferedInputStream.class))); }
@Test public void autoGUnzippedNonMarkableStreamShouldBeReadableInClear() throws IOException { InputStream nonMarkableStream = new NonMarkableByteArrayInputStream(HELLO_WORLD.getBytes(UTF_8)); assertThat(toUtf8String(InputStreams.autoGUnzip(nonMarkableStream)), is(HELLO_WORLD)); }