### Question:
Base64 { public static void encodeToFile(final byte[] dataToEncode, final String filename) throws IOException { if (dataToEncode == null) { throw new IllegalArgumentException("Data to encode was null."); } InnerOutputStream bos = null; try { bos = new InnerOutputStream(new FileOutputStream(filename), ENCODE); bos.write(dataToEncode); } finally { FileUtils.close(bos); } } private  Base64(); static void encode(final ByteBuffer raw, final ByteBuffer encoded); static void encode(final ByteBuffer raw, final CharBuffer encoded); static String encodeObject(final Serializable serializableObject); static String encodeObject(final Serializable serializableObject,
                                    final int options); static String encodeBytes(final byte[] source); static String encodeBytes(final byte[] source, final int options); static String encodeBytes(final byte[] source, final int off,
                                   final int len); static String encodeBytes(final byte[] source, final int off,
                                   final int len, final int options); static byte[] encodeBytesToBytes(final byte[] source); static byte[] encodeBytesToBytes(final byte[] source, final int off,
                                          final int len, final int options); static byte[] decode(final byte[] source); static byte[] decode(final byte[] source, final int off, final int len,
                              final int options); static byte[] decode(final String s); static byte[] decode(final String s, final int options); static Object decodeToObject(final String encodedObject); static Object decodeToObject(final String encodedObject,
                                      final int options,
                                      final ClassLoader loader); static void encodeToFile(final byte[] dataToEncode,
                                  final String filename); static void decodeToFile(final String dataToDecode,
                                  final String filename); static byte[] decodeFromFile(final String filename); static String encodeFromFile(final String filename); static void encodeFileToFile(final String infile, final String outfile); static void decodeFileToFile(final String infile, final String outfile); static final int NO_OPTIONS; static final int ENCODE; static final int DECODE; static final int GZIP; static final int DONT_GUNZIP; static final int DO_BREAK_LINES; static final int URL_SAFE; static final int ORDERED; }### Answer:
@Test public void testEncodeToFile() throws IOException { final String s = WaarpStringUtils.fillString('a', 100); Base64.encodeToFile(s.getBytes(), "/tmp/base64.txt"); final byte[] src = Base64.decodeFromFile("/tmp/base64.txt"); assertArrayEquals("Should be equals", s.getBytes(), src); final String s1 = WaarpStringUtils.readFile("/tmp/base64.txt"); final File file = new File("/tmp/source.txt"); Base64.decodeToFile(s1, "/tmp/source.txt"); final String s0 = WaarpStringUtils.readFile("/tmp/source.txt"); assertEquals("Should be equals", s, s0); Base64.encodeFileToFile(file.getAbsolutePath(), "/tmp/base64.txt"); String s2 = WaarpStringUtils.readFile("/tmp/base64.txt"); String s3 = Base64.encodeFromFile("/tmp/source.txt"); assertEquals("Should be equals", s2, s3); Base64.decodeFileToFile("/tmp/base64.txt", "/tmp/source2.txt"); s2 = WaarpStringUtils.readFile("/tmp/source.txt"); s3 = WaarpStringUtils.readFile("/tmp/source2.txt"); assertEquals("Should be equals", s2, s3); }