@@ -356,7 +356,7 @@ public static void WriteFileToLiteralData(
356
356
{
357
357
PgpLiteralDataGenerator lData = new PgpLiteralDataGenerator ( ) ;
358
358
Stream pOut = lData . Open ( output , fileType , file . Name , file . Length , file . LastWriteTime ) ;
359
- PipeFileContents ( file , pOut , 4096 ) ;
359
+ PipeFileContents ( file , pOut , 32768 ) ;
360
360
}
361
361
362
362
/// <summary>Write out the passed in file as a literal data packet in partial packet format.</summary>
@@ -376,15 +376,22 @@ private static void PipeFileContents(FileInfo file, Stream pOut, int bufSize)
376
376
FileStream inputStream = file . OpenRead ( ) ;
377
377
byte [ ] buf = new byte [ bufSize ] ;
378
378
379
- int len ;
380
- while ( ( len = inputStream . Read ( buf , 0 , buf . Length ) ) > 0 )
379
+ try
381
380
{
382
- pOut . Write ( buf , 0 , len ) ;
381
+ int len ;
382
+ while ( ( len = inputStream . Read ( buf , 0 , buf . Length ) ) > 0 )
383
+ {
384
+ pOut . Write ( buf , 0 , len ) ;
385
+ }
383
386
}
387
+ finally
388
+ {
389
+ Array . Clear ( buf , 0 , buf . Length ) ;
384
390
385
- Platform . Dispose ( pOut ) ;
386
- Platform . Dispose ( inputStream ) ;
387
- }
391
+ Platform . Dispose ( pOut ) ;
392
+ Platform . Dispose ( inputStream ) ;
393
+ }
394
+ }
388
395
#endif
389
396
390
397
private const int ReadAhead = 60 ;
0 commit comments