Class EncodeDecodeHelper


  • public class EncodeDecodeHelper
    extends Object
    This class is a helper class to do encoding and decoding
    • Constructor Detail

      • EncodeDecodeHelper

        public EncodeDecodeHelper()
    • Method Detail

      • encode

        public static byte[] encode​(byte[] input,
                                    EncodeDecodeTypes encodingType)
        Encodes the provided byte array using the specified encoding type.
        Parameters:
        input - The byte array to encode
        encodingType - The encoding to use
        Returns:
        The encoded ByteArrayOutputStream as a String
        Throws:
        IllegalArgumentException - if the specified decodingType is not supported
      • decode

        public static byte[] decode​(byte[] input,
                                    EncodeDecodeTypes decodingType)
        Decodes the provided byte array using the specified decoding type.
        Parameters:
        input - The byte array to decode
        decodingType - The decoding type to use
        Returns:
        The decoded byte array
        Throws:
        IllegalArgumentException - if the specified decodingType is not supported