@@ -0,0 +1,1606 @@
+package org.bouncycastle.util.io.test;%0A%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.IOException;%0Aimport java.security.SecureRandom;%0A%0Aimport org.bouncycastle.util.io.BufferingOutputStream;%0Aimport org.bouncycastle.util.test.SimpleTest;%0A%0Apublic class BufferingOutputStreamTest%0A    extends SimpleTest%0A%7B%0A    public String getName()%0A    %7B%0A        return %22BufferingStreamTest%22;%0A    %7D%0A%0A    public void performTest()%0A        throws Exception%0A    %7B%0A        SecureRandom random = new SecureRandom();%0A%0A        for (int i = 1; i != 256; i++)%0A        %7B%0A            byte%5B%5D data = new byte%5Bi%5D;%0A%0A            random.nextBytes(data);%0A%0A            checkStream(data, 16);%0A            checkStream(data, 33);%0A            checkStream(data, 128);%0A        %7D%0A    %7D%0A%0A    private void checkStream(byte%5B%5D data, int bufsize)%0A        throws IOException%0A    %7B%0A        ByteArrayOutputStream bOut = new ByteArrayOutputStream();%0A        BufferingOutputStream bfOut = new BufferingOutputStream(bOut, bufsize);%0A%0A        for (int i = 0; i != 10; i++)%0A        %7B%0A            bfOut.write(data%5B0%5D);%0A            bfOut.write(data, 1, data.length - 1);%0A        %7D%0A%0A        bfOut.close();%0A%0A        byte%5B%5D output = bOut.toByteArray();%0A%0A        for (int i = 0; i != 10; i++)%0A        %7B%0A             for (int j = 0; j != data.length; j++)%0A             %7B%0A                 if (output%5Bi * data.length + j%5D != data%5Bj%5D)%0A                 %7B%0A                     fail(%22data mismatch!%22);%0A                 %7D%0A             %7D%0A        %7D%0A    %7D%0A%0A    public static void main(%0A        String%5B%5D    args)%0A    %7B%0A        runTest(new BufferingOutputStreamTest());%0A    %7D%0A%7D%0A

update from GIT.