public void setBase64OutputStream(Class<? extends OutputStream> base64OutputStream) {
		if (base64OutputStream == null) {
			this.base64OutputStream = null;
			this.base64OutputStreamConstructor = null;
		}
		try {
			Constructor<? extends OutputStream> c = base64OutputStream.getConstructor(OutputStream.class);
			{ // Let's try the constructor out ...
				ByteArrayOutputStream baos = new ByteArrayOutputStream();
				OutputStream s = c.newInstance(baos);
				s.write("test123".getBytes("iso-8859-1"));
				s.close();
				String encoded = baos.toString("iso-8859-1");
				if (!encoded.equals("dGVzdDEyMw==")) {
					throw new IllegalArgumentException(base64OutputStream.getName()
							+ " incorrectly encodes BASE64 data");
				}
			}
			this.base64OutputStream = base64OutputStream;
			this.base64OutputStreamConstructor = c;
		} catch (NoSuchMethodException e) {
			throw new IllegalArgumentException(base64OutputStream.getName()
					+ " must expose public constructor taking java.io.OutputStream argument");
		} catch (IllegalArgumentException e) {
			throw e;
		} catch (Exception e) {
			throw new IllegalArgumentException(base64OutputStream.getName() + " can't be used for BASE64 encoding: "
					+ e);
		}
	}