Create a Zip File in Memory

前端 未结 3 735
悲哀的现实
悲哀的现实 2020-12-23 16:42

I\'m trying to zip a file (for example foo.csv) and upload it to a server. I have a working version which creates a local copy and then deletes the local copy. How would I

3条回答
  •  甜味超标
    2020-12-23 17:34

    As the NIO.2 API, which was introduce in Java SE 7, supports custom file systems you could try to combine an in-memory filesystem like https://github.com/marschall/memoryfilesystem and the Zip file system provided by Oracle.

    Note: I've written some utility classes to work with the Zip file system.

    The library is Open Source and it might help to get you started.

    Here is the tutorial: http://softsmithy.sourceforge.net/lib/0.4/docs/tutorial/nio-file/index.html

    You can download the library from here: http://sourceforge.net/projects/softsmithy/files/softsmithy/v0.4/

    Or with Maven:

      
        org.softsmithy.lib  
        softsmithy-lib-core  
        0.4   
      
    

提交回复
热议问题