fixed zip streaming
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -91,7 +91,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
<version>3.6.1</version>
|
||||
<configuration>
|
||||
<goalPrefix>amp</goalPrefix>
|
||||
</configuration>
|
||||
|
@@ -1,10 +1,10 @@
|
||||
package com.inteligr8.alfresco.amp;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
@@ -93,7 +93,7 @@ public class AmpMojo extends AbstractMojo implements ArtifactResolutionCallback
|
||||
|
||||
public void execute() throws MojoExecutionException {
|
||||
if (this.skip) {
|
||||
this.getLog().debug("Skipped AMP packaging");
|
||||
this.getLog().debug("Skipped AMP package");
|
||||
return;
|
||||
}
|
||||
this.getLog().debug("Executing AMP packaging");
|
||||
@@ -273,11 +273,12 @@ public class AmpMojo extends AbstractMojo implements ArtifactResolutionCallback
|
||||
zstream.putNextEntry(new ZipEntry(filename));
|
||||
|
||||
File file = new File(directory, filename);
|
||||
FileReader freader = new FileReader(file);
|
||||
FileInputStream fistream = new FileInputStream(file);
|
||||
BufferedInputStream bistream = new BufferedInputStream(fistream, this.streamBufferSize);
|
||||
try {
|
||||
IOUtil.copy(freader, zstream);
|
||||
IOUtil.copy(bistream, zstream);
|
||||
} finally {
|
||||
freader.close();
|
||||
bistream.close();
|
||||
}
|
||||
|
||||
zstream.closeEntry();
|
||||
@@ -300,13 +301,13 @@ public class AmpMojo extends AbstractMojo implements ArtifactResolutionCallback
|
||||
zstream.putNextEntry(new ZipEntry(targetPath + file.getName()));
|
||||
|
||||
FileInputStream fistream = new FileInputStream(file);
|
||||
BufferedInputStream bistream = new BufferedInputStream(fistream, this.streamBufferSize);
|
||||
try {
|
||||
IOUtil.copy(fistream, zstream);
|
||||
IOUtil.copy(bistream, zstream);
|
||||
} finally {
|
||||
fistream.close();
|
||||
bistream.close();
|
||||
}
|
||||
|
||||
zstream.flush();
|
||||
zstream.closeEntry();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user