/** * Similar to {@link #encodeBytes(byte[])} but returns a byte array instead of instantiating a String. This is more * efficient if you're working with I/O streams and have large data sets to encode. * * * @param source The data to convert * @return The Base64-encoded data as a byte[] (of ASCII characters) * @throws NullPointerException if source array is null * @since 2.3.1 */ public static byte[] encodeBytesToBytes(final byte[] source) { byte[] encoded = null; try { encoded = encodeBytesToBytes(source, 0, source.length, Base64.NO_OPTIONS); } catch (final java.io.IOException ex) { assert false : "IOExceptions only come from GZipping, which is turned off: " + ex.getMessage(); } return encoded; }
/** * Similar to {@link #encodeBytes(byte[])} but returns a byte array instead of instantiating a String. This is more * efficient if you're working with I/O streams and have large data sets to encode. * * * @param source The data to convert * @return The Base64-encoded data as a byte[] (of ASCII characters) * @throws NullPointerException if source array is null * @since 2.3.1 */ public static byte[] encodeBytesToBytes(final byte[] source) { byte[] encoded = null; try { encoded = encodeBytesToBytes(source, 0, source.length, Base64.NO_OPTIONS); } catch (final java.io.IOException ex) { assert false : "IOExceptions only come from GZipping, which is turned off: " + ex.getMessage(); } return encoded; }
final byte[] encoded = encodeBytesToBytes(source, off, len, options);
final byte[] encoded = encodeBytesToBytes(source, off, len, options);