/** * Encode string as a byte array in Base64 annotation. * * @param string * @return The Base64-encoded data as a string */ public static String encode(String string) { byte[] bytes; try { bytes = string.getBytes(PREFERRED_ENCODING); } catch (UnsupportedEncodingException e) { bytes = string.getBytes(); } return encodeBytes(bytes); }
/** * Encode string as a byte array in Base64 annotation. * * @param string * @return The Base64-encoded data as a string */ public static String encode(String string) { byte[] bytes; try { bytes = string.getBytes(PREFERRED_ENCODING); } catch (UnsupportedEncodingException e) { bytes = string.getBytes(); } return encodeBytes(bytes); }
/** * Encode string as a byte array in Base64 annotation. * * @param string * @return The Base64-encoded data as a string */ public static String encode(String string) { byte[] bytes; try { bytes = string.getBytes(PREFERRED_ENCODING); } catch (UnsupportedEncodingException e) { bytes = string.getBytes(); } return encodeBytes(bytes); }
/** * Encode string as a byte array in Base64 annotation. * * @param string * @return The Base64-encoded data as a string */ public static String encode(String string) { byte[] bytes; try { bytes = string.getBytes(PREFERRED_ENCODING); } catch (UnsupportedEncodingException e) { bytes = string.getBytes(); } return encodeBytes(bytes); }
/** * Encodes a byte array into Base64 notation. * * @param source * The data to convert * @return The Base64-encoded data as a String * @throws NullPointerException * if source array is null * @throws IllegalArgumentException * if source array, offset, or length are invalid * @since 2.0 */ public static String encodeBytes(byte[] source) { return encodeBytes(source, 0, source.length); }
/** * Encodes a byte array into Base64 notation. * * @param source * The data to convert * @return The Base64-encoded data as a String * @throws NullPointerException * if source array is null * @throws IllegalArgumentException * if source array, offset, or length are invalid * @since 2.0 */ public static String encodeBytes(byte[] source) { return encodeBytes(source, 0, source.length); }
/** * Encodes a byte array into Base64 notation. * * @param source * The data to convert * @return The Base64-encoded data as a String * @throws NullPointerException * if source array is null * @throws IllegalArgumentException * if source array, offset, or length are invalid * @since 2.0 */ public static String encodeBytes(byte[] source) { return encodeBytes(source, 0, source.length); }
/** * Encodes a byte array into Base64 notation. * * @param source The data to convert * @return The Base64-encoded data as a String * @throws NullPointerException if source array is null * @throws IllegalArgumentException if source array, offset, or length are invalid * @since 2.0 */ public static String encodeBytes(byte[] source) { return encodeBytes(source, 0, source.length); }