app/src/main/java/com/kunzisoft/keepass/utils/MemUtil.java
public static InputStream compress(final InputStream input) {
        final PipedInputStream compressedDataStream = new PipedInputStream(3 * 128);
        Log.d(TAG, "About to compress input data using gzip asynchronously...");
        PipedOutputStream compressionOutput;
        GZIPOutputStream gzipCompressedDataStream = null;
        try {
            compressionOutput = new PipedOutputStream(compressedDataStream);
            gzipCompressedDataStream = new GZIPOutputStream(compressionOutput);
            IOUtils.copy(input, gzipCompressedDataStream);
            Log.e(TAG, "Successfully compressed input data using gzip.");
        } catch (IOException e) {
            Log.e(TAG, "Failed to compress input data.", e);
        } finally {
            if (gzipCompressedDataStream != null) {
                try {
                    gzipCompressedDataStream.close();
                } catch (IOException e) {
                    Log.e(TAG, "Failed to close gzip output stream.", e);
                }
            }
        }
        return compressedDataStream;
    }
/**
     * Compresses the input data using GZip and outputs the compressed data.
     *
     * @param input
     *         An {@link InputStream} containing the input raw data.
     *
     * @return An {@link InputStream} to the compressed data.
     */
Compresses the input data using GZip and outputs the compressed data.
@param input
An  InputStream containing the input raw data.

@return An  InputStream to the compressed data.
Compresses the input data using GZip and outputs the compressed data . @param input An InputStream containing the input raw data . @return An InputStream to the compressed data .
public static InputStream compress(final InputStream input) {
        final PipedInputStream compressedDataStream = new PipedInputStream(3 * 128);
        Log.d(TAG, "About to compress input data using gzip asynchronously...");
        PipedOutputStream compressionOutput;
        GZIPOutputStream gzipCompressedDataStream = null;
        try {
            compressionOutput = new PipedOutputStream(compressedDataStream);
            gzipCompressedDataStream = new GZIPOutputStream(compressionOutput);
            IOUtils.copy(input, gzipCompressedDataStream);
            Log.e(TAG, "Successfully compressed input data using gzip.");
        } catch (IOException e) {
            Log.e(TAG, "Failed to compress input data.", e);
        } finally {
            if (gzipCompressedDataStream != null) {
                try {
                    gzipCompressedDataStream.close();
                } catch (IOException e) {
                    Log.e(TAG, "Failed to close gzip output stream.", e);
                }
            }
        }
        return compressedDataStream;
    }
public static InputStream compress ( final InputStream input ) { final PipedInputStream compressedDataStream = new PipedInputStream ( 3 * 128 ) ; Log . d ( TAG , "About to compress input data using gzip asynchronously..." ) ; PipedOutputStream compressionOutput ; GZIPOutputStream gzipCompressedDataStream = null ; try { compressionOutput = new PipedOutputStream ( compressedDataStream ) ; gzipCompressedDataStream = new GZIPOutputStream ( compressionOutput ) ; IOUtils . copy ( input , gzipCompressedDataStream ) ; Log . e ( TAG , "Successfully compressed input data using gzip." ) ; } catch ( IOException e ) { Log . e ( TAG , "Failed to compress input data." , e ) ; } finally { if ( gzipCompressedDataStream != null ) { try { gzipCompressedDataStream . close ( ) ; } catch ( IOException e ) { Log . e ( TAG , "Failed to close gzip output stream." , e ) ; } } } return compressedDataStream ; }
Compresses the input data using GZip and outputs the compressed data.
Compresses the input data using GZip and outputs the compressed data .