/** * * The same #encodeToByte(byte[], false)}. * @param sArr * The bytes to convert. If <code>null</code> or length 0 an empty array will be * returned. * @return A BASE64 encoded array without line separator. Never <code>null</code>. */ public static final byte[] encodeToByte(byte[] sArr) { return encodeToByte(sArr, false); }
/** * * The same #encodeToByte(byte[], false)}. * @param sArr * The bytes to convert. If <code>null</code> or length 0 an empty array will be * returned. * @return A BASE64 encoded array without line separator. Never <code>null</code>. */ public static final byte[] encodeToByte(byte[] sArr) { return encodeToByte(sArr, false); }
public static byte[] encode(byte[] data, PemLabel pemLabel) { byte[] base64 = Base64.encodeToByte(data, true); byte[] out = new byte[pemLabel.prefix.length + base64.length + pemLabel.postfix.length]; System.arraycopy(pemLabel.prefix, 0, out, 0, pemLabel.prefix.length); System.arraycopy(base64, 0, out, pemLabel.prefix.length, base64.length); System.arraycopy(pemLabel.postfix, 0, out, pemLabel.prefix.length + base64.length, pemLabel.postfix.length); return out; }
public static byte[] encode(byte[] data, PemLabel pemLabel) { byte[] base64 = Base64.encodeToByte(data, true); byte[] out = new byte[pemLabel.prefix.length + base64.length + pemLabel.postfix.length]; System.arraycopy(pemLabel.prefix, 0, out, 0, pemLabel.prefix.length); System.arraycopy(base64, 0, out, pemLabel.prefix.length, base64.length); System.arraycopy(pemLabel.postfix, 0, out, pemLabel.prefix.length + base64.length, pemLabel.postfix.length); return out; }