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
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