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);
		} catch (java.io.IOException e) {
			throw e;
		} finally {
			try {
				bos.close();
			} catch (Exception e) {
			}
		}

	}