@Override
    public void compress(final InputStream in, final OutputStream out, final String targetName) {
        ZipOutputStream zos = new ZipOutputStream(out);
        ZipEntry ze = new ZipEntry(targetName);
        try {
            zos.putNextEntry(ze);
            int len;
            while ((len = in.read(buffer)) > 0) {
                zos.write(buffer, 0, len);
            }
        } catch (IOException e) {
            throw new Audit4jRuntimeException("Could not compress the given data", e);
        } finally {
            try {
                in.close();
            } catch (IOException e) {
                throw new Audit4jRuntimeException("Could not compress the given data", e);
            } finally {
                try {
                    zos.closeEntry();
                } catch (IOException e) {
                    throw new Audit4jRuntimeException("Could not compress the given data", e);
                } finally {
                    try {
                        zos.close();
                    } catch (IOException e) {
                        throw new Audit4jRuntimeException("Could not compress the given data", e);
                    }
                }

            }

        }

    }
@ Override public void compress ( final InputStream in , final OutputStream out , final String targetName ) { ZipOutputStream zos = new ZipOutputStream ( out ) ; ZipEntry ze = new ZipEntry ( targetName ) ; try { zos . putNextEntry ( ze ) ; int len ; while ( ( len = in . read ( buffer ) ) > 0 ) { zos . write ( buffer , 0 , len ) ; } } catch ( IOException e ) { throw new Audit4jRuntimeException ( "Could not compress the given data" , e ) ; } finally { try { in . close ( ) ; } catch ( IOException e ) { throw new Audit4jRuntimeException ( "Could not compress the given data" , e ) ; } finally { try { zos . closeEntry ( ) ; } catch ( IOException e ) { throw new Audit4jRuntimeException ( "Could not compress the given data" , e ) ; } finally { try { zos . close ( ) ; } catch ( IOException e ) { throw new Audit4jRuntimeException ( "Could not compress the given data" , e ) ; } } } } }
/*
(non-Javadoc)

@see
org.audit4j.core.handler.file.archive.Compressor#compress(java.io.InputStream
, java.io.OutputStream, java.lang.String)