(de)compressing files using NIO

后端 未结 2 1471
执念已碎
执念已碎 2021-01-14 12:09

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

2条回答
  •  我在风中等你
    2021-01-14 12:31

    No, specialized ZIP channel does not exist yet... I think that you can do the following. Use NIO to read from any channel you want to Buffer. Then retrieve bytes you have just read from buffer to byte array, wrap the array using ByteArrayInputStream and pass it to ZIPInputStream.

提交回复
热议问题