@@ -575,7 +575,7 @@ private static String makeUncompressed(String filename) throws Exception {
575575 try {
576576 if (suffix .equalsIgnoreCase ("Z" )) {
577577 // Z file can only contain one file - copy the whole thing
578- try (InputStream in = new UncompressInputStream (new FileInputStream (baseFilename ))) {
578+ try (InputStream in = new UncompressInputStream (new BufferedInputStream ( new FileInputStream (baseFilename ) ))) {
579579 copy (in , fout , 100000 );
580580 }
581581 if (NetcdfFile .debugCompress ) {
@@ -584,7 +584,7 @@ private static String makeUncompressed(String filename) throws Exception {
584584
585585 } else if (suffix .equalsIgnoreCase ("zip" )) {
586586 // find specified zip entry, if it exists
587- try (ZipInputStream zin = new ZipInputStream (new FileInputStream (baseFilename ))) {
587+ try (ZipInputStream zin = new ZipInputStream (new BufferedInputStream ( new FileInputStream (baseFilename ) ))) {
588588 // If a desired zipentry ID was appended to method's filename parameter, then itempath
589589 // is of length > 1 and ID starts at itempath char offset 1.
590590 String itemName = (itempath .length () > 1 ) ? itempath .substring (1 ) : "" ;
@@ -606,15 +606,15 @@ private static String makeUncompressed(String filename) throws Exception {
606606
607607 } else if (suffix .equalsIgnoreCase ("bz2" )) {
608608 // bz2 can only contain one file - copy the whole thing
609- try (InputStream in = new CBZip2InputStream (new FileInputStream (baseFilename ), true )) {
609+ try (InputStream in = new CBZip2InputStream (new BufferedInputStream ( new FileInputStream (baseFilename ) ), true )) {
610610 copy (in , fout , 100000 );
611611 }
612612 if (NetcdfFile .debugCompress )
613613 log .info ("unbzipped {} to {}" , filename , uncompressedFile );
614614
615615 } else if (suffix .equalsIgnoreCase ("gzip" ) || suffix .equalsIgnoreCase ("gz" )) {
616616 // gzip/gz concatenates streams - copy the whole thing
617- try (InputStream in = new GZIPInputStream (new FileInputStream (baseFilename ))) {
617+ try (InputStream in = new GZIPInputStream (new BufferedInputStream ( new FileInputStream (baseFilename ) ))) {
618618 copy (in , fout , 100000 );
619619 }
620620
0 commit comments