@@ -5,7 +5,7 @@ namespace Org.BouncyCastle.Utilities.IO
5
5
{
6
6
public sealed class Streams
7
7
{
8
- private const int BufferSize = 512 ;
8
+ private const int BufferSize = 4096 ;
9
9
10
10
private Streams ( )
11
11
{
@@ -51,10 +51,24 @@ public static int ReadFully(Stream inStr, byte[] buf, int off, int len)
51
51
return totalRead ;
52
52
}
53
53
54
- public static void PipeAll ( Stream inStr , Stream outStr )
54
+ /// <summary>Write the full contents of inStr to the destination stream outStr.</summary>
55
+ /// <param name="inStr">Source stream.</param>
56
+ /// <param name="outStr">Destination stream.</param>
57
+ /// <exception cref="IOException">In case of IO failure.</exception>
58
+ public static void PipeAll ( Stream inStr , Stream outStr )
55
59
{
56
- byte [ ] bs = new byte [ BufferSize ] ;
57
- int numRead ;
60
+ PipeAll ( inStr , outStr , BufferSize ) ;
61
+ }
62
+
63
+ /// <summary>Write the full contents of inStr to the destination stream outStr.</summary>
64
+ /// <param name="inStr">Source stream.</param>
65
+ /// <param name="outStr">Destination stream.</param>
66
+ /// <param name="bufferSize">The size of temporary buffer to use.</param>
67
+ /// <exception cref="IOException">In case of IO failure.</exception>
68
+ public static void PipeAll ( Stream inStr , Stream outStr , int bufferSize )
69
+ {
70
+ byte [ ] bs = new byte [ bufferSize ] ;
71
+ int numRead ;
58
72
while ( ( numRead = inStr . Read ( bs , 0 , bs . Length ) ) > 0 )
59
73
{
60
74
outStr . Write ( bs , 0 , numRead ) ;
0 commit comments