public static void encodeToFile(byte[] dataToEncode, String filename) throws java.io.IOException {

		if (dataToEncode == null) {
			throw new NullPointerException("Data to encode was null.");
		} // end iff

		Base64.OutputStream bos = null;
		try {
			bos = new Base64.OutputStream(new java.io.FileOutputStream(filename), Base64.ENCODE);
			bos.write(dataToEncode);
		} // end try
		catch (java.io.IOException e) {
			throw e; // Catch and throw to execute finally{} block
		} // end catch: java.io.IOException
		finally {
			try {
				bos.close();
			} catch (Exception e) {
			}
		} // end finally

	} // end encodeToFile