我查看了JDK和Apache压缩库附带的默认Zip库,我对它们不满意,原因有3个:
They are bloated and have bad API design. I have to write 50 lines of boiler plate byte array output, zip input, file out streams and close relevant streams and catch exceptions and move byte buffers on my own? Why can't I have a simple API that looks like this Zipper.unzip(InputStream zipFile, File targetDirectory, String password = null) and Zipper.zip(File targetDirectory, String password = null) that just works? It seems zipping unzipping destroys file meta-data and password handling is broken. Also, all the libraries I tried were 2-3x slow compared to the command line zip tools I get with UNIX?
对我来说(2)和(3)是次要的点,但我真的想要一个良好的测试库与一行接口。