public byte[] compress(final String data, byte[] uploadFile) throws CompressionException {

		if (!StringUtils.hasText(data)) {
			return null;
		}

		ByteArrayOutputStream baos = null;
		OutputStream deflater = null;
		byte[] compressedData = null;
		try {
			baos = new ByteArrayOutputStream();
			deflater = new DeflaterOutputStream(baos);
			deflater.write(data.getBytes());
			if (uploadFile != null) {
				deflater.write(uploadFile);
			}
			deflater.close();
			compressedData = baos.toByteArray();
			return compressedData;
		} catch (IOException ioe) {
			throw new CompressionException("IOException while compress the data using Deflate compression.", ioe);
		} finally {
			if (baos != null) {
				try {
					baos.close();
				} catch (IOException e) {
					LOG.error("Unable to close ByteArrayOutputStream.");
				}
			}
		}
	}
public byte [ ] compress ( final String data , byte [ ] uploadFile ) throws CompressionException { if ( ! StringUtils . hasText ( data ) ) { return null ; } ByteArrayOutputStream baos = null ; OutputStream deflater = null ; byte [ ] compressedData = null ; try { baos = new ByteArrayOutputStream ( ) ; deflater = new DeflaterOutputStream ( baos ) ; deflater . write ( data . getBytes ( ) ) ; if ( uploadFile != null ) { deflater . write ( uploadFile ) ; } deflater . close ( ) ; compressedData = baos . toByteArray ( ) ; return compressedData ; } catch ( IOException ioe ) { throw new CompressionException ( "IOException while compress the data using Deflate compression." , ioe ) ; } finally { if ( baos != null ) { try { baos . close ( ) ; } catch ( IOException e ) { LOG . error ( "Unable to close ByteArrayOutputStream." ) ; } } } }
{@inheritDoc}}