@Test public void testEncodeAll8bitCharacters() throws UnsupportedEncodingException { String expectedStr = "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIj" + "JCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZH" + "SElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWpr" + "bG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6P" + "kJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKz" + "tLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX" + "2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7" + "/P3+/w=="; byte[] inBytes = new byte[256]; byte[] outB64; String outB64Str; for (int i = 0; i < 256; i++) { inBytes[i] = (byte) i; } outB64 = Base64.encode(inBytes, inBytes.length); outB64Str = new String(outB64, "us-ascii"); assertEquals(expectedStr, outB64Str); }
public static String encode(String utf8Str) throws UnsupportedEncodingException{ byte[] bytes = toUTF8Bytes(utf8Str); byte[] encoded = encode(bytes,bytes.length); return toUTF8String(encoded); }
Base64 { public static String encode(String utf8Str) throws UnsupportedEncodingException{ byte[] bytes = toUTF8Bytes(utf8Str); byte[] encoded = encode(bytes,bytes.length); return toUTF8String(encoded); } }
Base64 { public static String encode(String utf8Str) throws UnsupportedEncodingException{ byte[] bytes = toUTF8Bytes(utf8Str); byte[] encoded = encode(bytes,bytes.length); return toUTF8String(encoded); }  }
Base64 { public static String encode(String utf8Str) throws UnsupportedEncodingException{ byte[] bytes = toUTF8Bytes(utf8Str); byte[] encoded = encode(bytes,bytes.length); return toUTF8String(encoded); }  static String decode(String strIn); static byte[] decode(byte[] unfilteredBytes, int unFilterLen); static byte[] filterPemBytes(byte[] bi, int blen); static String encode(String utf8Str); static byte[] encode(byte[] bi, int ilen); static String toHex(byte[] bytes); static byte[] toUTF8Bytes(String strIn); static String toUTF8String(byte[] bytes); }
Base64 { public static String encode(String utf8Str) throws UnsupportedEncodingException{ byte[] bytes = toUTF8Bytes(utf8Str); byte[] encoded = encode(bytes,bytes.length); return toUTF8String(encoded); }  static String decode(String strIn); static byte[] decode(byte[] unfilteredBytes, int unFilterLen); static byte[] filterPemBytes(byte[] bi, int blen); static String encode(String utf8Str); static byte[] encode(byte[] bi, int ilen); static String toHex(byte[] bytes); static byte[] toUTF8Bytes(String strIn); static String toUTF8String(byte[] bytes); static final int PAGESIZE; static final int MAX_FILTER_ENTRY_SIZE; static final int[] charToSix; static final int[] sixToChar; }