Class DeflateHelper


  • @ThreadSafe
    public class DeflateHelper
    extends java.lang.Object
    Deflate (RFC 1951) helper methods, intended for use by JWE encrypters and decrypters. This class is thread-safe.
    Version:
    2014-07-08
    Author:
    Vladimir Dzhuvinov
    • Constructor Summary

      Constructors 
      Constructor Description
      DeflateHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] applyCompression​(JWEHeader jweHeader, byte[] bytes)
      Applies compression to the specified plain text if requested.
      static byte[] applyDecompression​(JWEHeader jweHeader, byte[] bytes)
      Applies decompression to the specified plain text if requested.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DeflateHelper

        public DeflateHelper()
    • Method Detail

      • applyCompression

        public static byte[] applyCompression​(JWEHeader jweHeader,
                                              byte[] bytes)
                                       throws JOSEException
        Applies compression to the specified plain text if requested.
        Parameters:
        jweHeader - The JWE header. Must not be null.
        bytes - The plain text bytes. Must not be null.
        Returns:
        The bytes to encrypt.
        Throws:
        JOSEException - If compression failed or the requested compression algorithm is not supported.
      • applyDecompression

        public static byte[] applyDecompression​(JWEHeader jweHeader,
                                                byte[] bytes)
                                         throws JOSEException
        Applies decompression to the specified plain text if requested.
        Parameters:
        jweHeader - The JWE header. Must not be null.
        bytes - The plain text bytes. Must not be null.
        Returns:
        The output bytes, decompressed if requested.
        Throws:
        JOSEException - If decompression failed or the requested compression algorithm is not supported.