/** * Converts a char array into a byte array using the default character set. * * @param chars * The source characters. * @return The result bytes. */ public static byte[] toByteArray(char[] chars) { /* IoUtilsからコピー */ return /*IoUtils.*/toByteArray(chars, java.nio.charset.Charset .defaultCharset().name()); }
/** * Encodes an entire chars array into a Base64 string, with optional * newlines after every 76 characters. * * @param chars * The characters array to encode. * @param newlines * Indicates whether or not newlines are desired. * @return The encoded string. */ public static String encode(char[] chars, boolean newlines) { return encode(/*IoUtils.*/toByteArray(chars), newlines); }
/** * Encodes an entire chars array into a Base64 string, with optional * newlines after every 76 characters. * * @param chars * The characters array to encode. * @param charset * The character set to use for the character to byte conversion. * @param newlines * Indicates whether or not newlines are desired. * @return The encoded string. */ public static String encode(char[] chars, String charset, boolean newlines) { return encode(/*IoUtils.*/toByteArray(chars, charset), newlines); }