package org.bouncycastle.util.io;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public final class Streams
{
    private static int BUFFER_SIZE = 512;

    public static byte[] readAll(InputStream inStr)
        throws IOException
    {
        ByteArrayOutputStream buf = new ByteArrayOutputStream();
        doPipe(inStr, buf);
        return buf.toByteArray();
    }

    private static void doPipe(InputStream inStr, OutputStream outStr)
        throws IOException
    {
        byte[] bs = new byte[BUFFER_SIZE];
        int numRead;
        while ((numRead = inStr.read(bs, 0, bs.length)) >= 0)
        {
            outStr.write(bs, 0, numRead);
        }
    }
}

@@ -382,22 +382,23 @@
         
-doPipe
+pipeAll
 (inStr, 
@@ -453,33 +453,578 @@
    p
-rivate static void doPipe
+ublic static int readFully(InputStream inStr, byte%5B%5D buf)%0A        throws IOException%0A    %7B%0A        return readFully(inStr, buf, 0, buf.length);%0A    %7D%0A%0A    public static int readFully(InputStream inStr, byte%5B%5D buf, int off, int len)%0A        throws IOException%0A    %7B%0A        int totalRead = 0;%0A        while (totalRead %3C len)%0A        %7B%0A            int numRead = inStr.read(buf, off + totalRead, len - totalRead);%0A            if (numRead %3C 0)%0A                break;%0A            totalRead += numRead;%0A        %7D%0A        return totalRead;%0A    %7D%0A%0A    public static void pipeAll
 (Inp

Add more methods