public String invoice2zip(String invoice, String filename, Container container) throws StreamTransformationException{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ZipOutputStream zos = new ZipOutputStream(baos);
BASE64Encoder encoder = new BASE64Encoder();
String encoded = "";
try{
zos.putNextEntry(new ZipEntry(filename));
zos.write(invoice.getBytes());
zos.close();
encoded = encoder.encode( baos.toByteArray());
}catch(Exception e){
return "";
}
return encoded;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 |