Class EncodingUtils


public final class EncodingUtils extends Object
Collection of helper methods.

This class is not intended to be instantiated or extended by clients.

  • Constructor Details

    • EncodingUtils

      public EncodingUtils()
  • Method Details

    • encodeSlashes

      public static String encodeSlashes(String nodeName)
      Encode strings containing forward slashes so that they can be used as node names with secure preferences. It is the responsibility of the consumer to manually encode such strings before attempting to obtain corresponding nodes from secure preferences.

      Internally, the class uses a subset of JIT encoding. The forward slashes and backward slashes are encoded.

      nodeName - string to be encoded
      encoded string, null if argument was null
      See Also:
    • decodeSlashes

      public static String decodeSlashes(String nodeName)
      Decode strings previously encoded with the encodeSlashes(String) method.
      nodeName - string to be decoded
      decoded string, null if argument was null
    • encodeBase64

      public static String encodeBase64(byte[] bytes)
      Provides Base64 encoding of the data. This Base64 encoding does not insert end-of-line characters (but can properly decode strings with EOLs inserted).
      bytes - data to be encoded
      data encoded as Base64 string
    • decodeBase64

      public static byte[] decodeBase64(String string)
      Provides decoding of Base64-encoded string
      string - data encoded as Base64
      decoded data