Skip to content

Commit 9d54c83

Browse files
committed
Added buffering to gzipinputstream for a great win
1 parent dd7bd3c commit 9d54c83

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

src/main/java/org/codehaus/plexus/archiver/gzip/GZipUnArchiver.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@
2020
import org.codehaus.plexus.archiver.AbstractUnArchiver;
2121
import org.codehaus.plexus.archiver.ArchiverException;
2222

23+
import java.io.BufferedInputStream;
2324
import java.io.FileInputStream;
2425
import java.io.File;
2526
import java.io.IOException;
27+
import java.io.InputStream;
2628
import java.util.zip.GZIPInputStream;
2729

2830
import static org.codehaus.plexus.archiver.util.Streams.*;
@@ -59,12 +61,12 @@ protected void execute()
5961
}
6062
}
6163

62-
private GZIPInputStream getGzipInputStream( FileInputStream in )
64+
private InputStream getGzipInputStream( FileInputStream in )
6365
throws ArchiverException
6466
{
6567
try
6668
{
67-
return new GZIPInputStream( in );
69+
return new BufferedInputStream( new GZIPInputStream( in ));
6870
}
6971
catch ( IOException e )
7072
{

src/main/java/org/codehaus/plexus/archiver/gzip/PlexusIoGzipResourceCollection.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.codehaus.plexus.archiver.gzip;
22

3+
import java.io.BufferedInputStream;
34
import java.io.File;
45
import java.io.FileInputStream;
56
import java.io.IOException;
@@ -34,7 +35,7 @@ protected InputStream getInputStream( File file )
3435
InputStream fis = new FileInputStream( file );
3536
try
3637
{
37-
InputStream result = new GZIPInputStream( fis );
38+
InputStream result = new BufferedInputStream( new GZIPInputStream( fis ));
3839
fis = null;
3940
return result;
4041
}

src/main/java/org/codehaus/plexus/archiver/tar/GZipTarFile.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.codehaus.plexus.archiver.tar;
22

3+
import java.io.BufferedInputStream;
34
import java.io.File;
45
import java.io.IOException;
56
import java.io.InputStream;
@@ -23,14 +24,14 @@ protected InputStream getInputStream( File file )
2324
throws IOException
2425
{
2526
final InputStream inputStream = super.getInputStream( file );
26-
return new GZIPInputStream( inputStream )
27+
return new BufferedInputStream( new GZIPInputStream( inputStream )
2728
{
2829
public void close()
2930
throws IOException
3031
{
3132
super.close();
3233
inputStream.close();
3334
}
34-
};
35+
});
3536
}
3637
}

src/main/java/org/codehaus/plexus/archiver/tar/TarUnArchiver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private InputStream decompress( UntarCompressionMethod compression, final File f
139139
{
140140
if ( compression == UntarCompressionMethod.GZIP )
141141
{
142-
return new GZIPInputStream( istream );
142+
return new BufferedInputStream( new GZIPInputStream( istream ));
143143
}
144144
else if ( compression == UntarCompressionMethod.BZIP2 )
145145
{

0 commit comments

Comments
 (0)