-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecompressor.java
More file actions
48 lines (37 loc) · 1.34 KB
/
decompressor.java
File metadata and controls
48 lines (37 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package compressordecompressor;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.GZIPInputStream;
/**
*
* @author shivenduac
*/
public class decompressor {
public static void method(File file) throws IOException{
String fileDirectory= file.getParent();
FileInputStream fis= new FileInputStream(file);
GZIPInputStream gzipIS= new GZIPInputStream(fis);
FileOutputStream fos=new FileOutputStream(fileDirectory+"/Decompressedfilecheck");
byte[] buffer=new byte[1024];
int len;
while((len=gzipIS.read(buffer)) !=-1){
System.out.println("length of file"+len);
fos.write(buffer, 0,len);
}
gzipIS.close();
fis.close();
fos.close();
}
public static void main(String[] args) throws IOException{
File path=new File("/Users/shivenduac/Downloads/Compressor/compressordecompressor/Compressedfile.gz");
method(path);
//System.out.print();
}
}