Package org.forgerock.json.jose.jwe
Class CompressionManager
- java.lang.Object
-
- org.forgerock.json.jose.jwe.CompressionManager
-
public class CompressionManager extends Object
A service to get the appropriate CompressionHandler for a specified Compression algorithm.For details of all supported algorithms see
CompressionAlgorithm
.- Since:
- 2.0.0
-
-
Constructor Summary
Constructors Constructor Description CompressionManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
compress(CompressionAlgorithm compressionAlgorithm, String data)
Convenience method equivalent toBase64url.encode(getCompressionHandler(compressionAlgorithm).compress(data.getBytes(Utils.CHARSET)))
.byte[]
decompress(CompressionAlgorithm compressionAlgorithm, String data)
Convenience method equivalent togetCompressionHandler(compressionAlgorithm).decompress(Base64url.decode(data))
.CompressionHandler
getCompressionHandler(CompressionAlgorithm algorithm)
Gets the appropriate CompressionHandler that can perform the required compression using the given compression algorithm.
-
-
-
Method Detail
-
getCompressionHandler
public CompressionHandler getCompressionHandler(CompressionAlgorithm algorithm)
Gets the appropriate CompressionHandler that can perform the required compression using the given compression algorithm.- Parameters:
algorithm
- The Compression algorithm.- Returns:
- The CompressionHandler.
-
compress
public String compress(CompressionAlgorithm compressionAlgorithm, String data)
Convenience method equivalent toBase64url.encode(getCompressionHandler(compressionAlgorithm).compress(data.getBytes(Utils.CHARSET)))
.- Parameters:
compressionAlgorithm
- the compression algorithm to use.data
- the data to compress.- Returns:
- the base64url-encoded compressed data.
-
decompress
public byte[] decompress(CompressionAlgorithm compressionAlgorithm, String data)
Convenience method equivalent togetCompressionHandler(compressionAlgorithm).decompress(Base64url.decode(data))
.- Parameters:
compressionAlgorithm
- the compression algorithm to use.data
- the base64url-encoded data to decompress.- Returns:
- the decompressed data.
-
-