public static void main(String[] args) throws Exception {
byte[] data = initData(1024);
OutputStream nullOut = new NullOutputStream();
Base64OutputStream base64Out = new Base64OutputStream(nullOut);
// warmup
for (int i = 0; i < 2000; i++) {
base64Out.write(data);
}
Thread.sleep(100);
// test
long t0 = System.currentTimeMillis();
final int repetitions = 500000;
for (int i = 0; i < repetitions; i++) {
base64Out.write(data);
}
base64Out.close();
long dt = System.currentTimeMillis() - t0;
long totalBytes = data.length * (long) repetitions;
double mbPerSec = (totalBytes / 1024.0 / 1024) / (dt / 1000.0);