This is my code: (zipped file contains text file)
ByteBuffer buffer = ByteBuffer.allocateDirect(8192);
try {
ReadableByteChannel gzc = Channels.newChannel(new GZIPInputStream(Channels.newInputStream( Channels.newChannel( new FileInputStream("C:\\temp\\111.gz")))));
gzc.read(buffer);
}
Performance will also depend on the buffer size. You might want to wrap a BufferedInputStream() into the mix, with a large buffer (eg !MB), to get a lot of blocks from the disk at once.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.