推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
superhan
V2EX  ›  Python

求帮忙,使用 Python 解压 Java 压缩的 zip 文件问题

  •  
  •   superhan · Nov 14, 2017 · 3107 views
    This topic created in 3126 days ago, the information mentioned may be changed or developed.

    java zip 压缩部分是这样到:

    byteArrayOutputStream = new ByteArrayOutputStream(); zipOutputStream = new ZipOutputStream(byteArrayOutputStream); zipOutputStream.putNextEntry(new ZipEntry("0")); zipOutputStream.write(paramString.getBytes()); zipOutputStream.closeEntry(); arrayOfByte = byteArrayOutputStream.toByteArray();

    python 使用 zipfile 时会报错,识别不出这是一个 zip 文件。请高手指点一下!!

    Supplement 1  ·  Nov 15, 2017
    是因为 java 代码中, 没有关闭 zipOutputStream 就返回了压缩的数据流,导致 zip 不完整。
    4 replies    2017-11-15 16:36:00 +08:00
    superhan
        1
    superhan  
    OP
       Nov 14, 2017
    java python 高手帮忙看看
    lieh222
        2
    lieh222  
       Nov 15, 2017   ❤️ 1
    这是 zip 文件还是 zlib 压缩的数据流呀。。
    superhan
        3
    superhan  
    OP
       Nov 15, 2017
    @lieh222 你好,是压缩到数据流,我把数据流保存成为文件,但是解压还是失败,好像是缺少一些尾部信息。
    superhan
        4
    superhan  
    OP
       Nov 15, 2017
    @lieh222 你好 找到原因了谢谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1512 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 16:46 · PVG 00:46 · LAX 09:46 · JFK 12:46
    ♥ Do have faith in what you're doing.