@Test public void runTest() { assertEquals("SEVMTE8=", Base64.base64("HELLO", Mode.ENCODE)); assertEquals("HELLO", Base64.base64("SEVMTE8=", Mode.DECODE)); }
public static String base64(String input, Mode mode) { String output = ""; byte[] encode = input.getBytes(); byte[] decode; org.apache.commons.codec.binary.Base64 base64 = new org.apache.commons.codec.binary.Base64(); if (mode == Mode.ENCODE) { output = base64.encodeToString(encode); } if (mode == Mode.DECODE) { decode = base64.decode(input); output = new String(decode); } return output; }
Base64 { public static String base64(String input, Mode mode) { String output = ""; byte[] encode = input.getBytes(); byte[] decode; org.apache.commons.codec.binary.Base64 base64 = new org.apache.commons.codec.binary.Base64(); if (mode == Mode.ENCODE) { output = base64.encodeToString(encode); } if (mode == Mode.DECODE) { decode = base64.decode(input); output = new String(decode); } return output; } }
Base64 { public static String base64(String input, Mode mode) { String output = ""; byte[] encode = input.getBytes(); byte[] decode; org.apache.commons.codec.binary.Base64 base64 = new org.apache.commons.codec.binary.Base64(); if (mode == Mode.ENCODE) { output = base64.encodeToString(encode); } if (mode == Mode.DECODE) { decode = base64.decode(input); output = new String(decode); } return output; }  }
Base64 { public static String base64(String input, Mode mode) { String output = ""; byte[] encode = input.getBytes(); byte[] decode; org.apache.commons.codec.binary.Base64 base64 = new org.apache.commons.codec.binary.Base64(); if (mode == Mode.ENCODE) { output = base64.encodeToString(encode); } if (mode == Mode.DECODE) { decode = base64.decode(input); output = new String(decode); } return output; }  static void main(String[] args); static String base64(String input, Mode mode); }
Base64 { public static String base64(String input, Mode mode) { String output = ""; byte[] encode = input.getBytes(); byte[] decode; org.apache.commons.codec.binary.Base64 base64 = new org.apache.commons.codec.binary.Base64(); if (mode == Mode.ENCODE) { output = base64.encodeToString(encode); } if (mode == Mode.DECODE) { decode = base64.decode(input); output = new String(decode); } return output; }  static void main(String[] args); static String base64(String input, Mode mode);  }