Extracting zipped file from ResourceStream throws error “Invalid stored block lengths”

后端 未结 3 1053
醉酒成梦
醉酒成梦 2020-12-11 15:23

I am trying to extract a ZIP file from my current JAR using:

InputStream resource = getClass().getClassLoader().getResourceAsStream(name);

3条回答
  •  囚心锁ツ
    2020-12-11 16:20

    After a few more hours of searching, I decompiled the maven-resources-plugin and noticed it used UTF-8 encoding by default. I quickly looked up the encoding I would need (ISO-8859-1) and put it in my pom.

    
        ISO-8859-1
    
    

    Now the zip file copies into the jar perfectly, no corruption at all.

提交回复
热议问题