In the many examples online, files are (de)compressed in java using a coded buffer. With NIO, however, there is no need to choose a good buffer size. I found examples for fi
You can use the static utility methods in java.nio.channels.Channels to wrap streams in channels and vice versa.
E.g. to create a channel, from which you can read the uncompressed data from a gzip compressed file:
FileChannel fc =
new RandomAccessFile("input.gz", "r").getChannel();
ReadableByteChannel gzc =
Channels.newChannel(
new GZIPInputStream(
Channels.newInputStream(fc)));