summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Gunzip.java15
1 files changed, 4 insertions, 11 deletions
diff --git a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Gunzip.java b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Gunzip.java
index a24afbe..89aa731 100644
--- a/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Gunzip.java
+++ b/ems/boco/src/main/java/org/onap/vfc/nfvo/emsdriver/commons/utils/Gunzip.java
@@ -24,20 +24,13 @@ public class Gunzip {
*
*/
public void unCompress(String gzFileName, String toFile) throws IOException {
- try {
- FileInputStream gzInput = new FileInputStream(gzFileName);
- GZIPInputStream gzIn = new GZIPInputStream(gzInput);
+ try ( FileInputStream gzInput = new FileInputStream(gzFileName);
+ GZIPInputStream gzIn = new GZIPInputStream(gzInput)){
File tofile = new File(toFile);
enable(tofile);
- FileOutputStream fileOutput = new FileOutputStream(tofile, false);
- try{
+ try(FileOutputStream fileOutput = new FileOutputStream(tofile, false)){
moveBytes(gzIn, fileOutput, -1, -1, 1024);
- } finally {
- gzInput.close();
- gzIn.close();
- fileOutput.close();
- }
-
+ }
}catch(IOException e){
throw e;
}