I am trying to do compress an InputStream and return an InputStream:
public InputStream compress (InputStream in){
// Read "in" and write to ZipOutputStream
// Convert ZipOutputStream into InputStream and return
}
I am compressing one file (so I could use GZIP) but will do more in future (so I opted for ZIP). In most of the places:
How can I convert ZipInputStream to InputStream?
They use toBytesArray() or getBytes() which do not exist (!) - ZipOutputStream
My problems are:
How do I convert the ZipOutPutStream into InputStream if such methods don't exist?
When creating the ZipOutPutStream() there is no default constructor. Should I create a new ZipOutputStrem(new OutputStream() ) ??