Reading from a ZipInputStream into a ByteArrayOutputStream

后端 未结 10 1547
旧时难觅i
旧时难觅i 2021-02-05 08:14

I am trying to read a single file from a java.util.zip.ZipInputStream, and copy it into a java.io.ByteArrayOutputStream (so that I can then create a

10条回答
  •  猫巷女王i
    2021-02-05 08:44

    Check if the input stream is positioned in the begging.

    Otherwise, as implementation: I do not think that you need to write to the result stream while you are reading, unless you process this exact stream in another thread.

    Just create a byte array, read the input stream, then create the output stream.

提交回复
热议问题