Class Base64Encoder


  • @Scriptable
    public final class Base64Encoder
    extends Object
    Base64 encoding as described in RFC 2045 section 6.8.

    0 A17 R34 i51 z
    1 B18 S35 j52 0
    2 C19 T36 k53 1
    3 D20 U37 l54 2
    4 E21 V38 m55 3
    5 F22 W39 n56 4
    6 G23 X40 o57 5
    7 H24 Y41 p58 6
    8 I25 Z42 q59 7
    9 J26 a43 r60 8
    10 K27 b44 s61 9
    11 L28 c45 t62 +
    12 M29 d46 u63 /
    13 N30 e47 v
    14 O31 f48 w(pad) =
    15 P32 g49 x
    16 Q33 h50 y
    See Also:
    Base64
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] decode​(char[] p_achSrc)
      Decode a Base64-encoded byte array.
      static byte[] decode​(char[] p_achSrc, int p_iSrcLen)
      Decode a Base64-encoded byte array.
      static char[] encode​(byte[] p_aby)
      Base64-encode a byte array.
      static char[] encode​(byte[] p_aby, int p_iOffset, int p_iLength)
      Base64-encode a byte array with a specified offset and length.
    • Method Detail

      • encode

        public static char[] encode​(byte[] p_aby)
        Base64-encode a byte array.
        Parameters:
        p_aby - The array to encode.
        Returns:
        The encoded data as a character array.
      • encode

        public static char[] encode​(byte[] p_aby,
                                    int p_iOffset,
                                    int p_iLength)
        Base64-encode a byte array with a specified offset and length.
        Parameters:
        p_aby - The array to encode.
        p_iOffset - The offset where encoding begins.
        p_iLength - Length to encode.
        Returns:
        The encoded data as a character array or null if p_aby is null or if p_iLength is 0.
      • decode

        public static byte[] decode​(char[] p_achSrc)
        Decode a Base64-encoded byte array.
        Parameters:
        p_achSrc - Encoded byte array.
        Returns:
        The decoded byte array or null if p_achSrc is null or has zero length.
      • decode

        public static byte[] decode​(char[] p_achSrc,
                                    int p_iSrcLen)
        Decode a Base64-encoded byte array.
        Parameters:
        p_achSrc - Encoded byte array.
        p_iSrcLen - Length of the given byte array.
        Returns:
        The decoded byte array or null if p_achSrc is null or has zero length.