ControlC
· Pastebin
Login
Register
ControlC
/
Create paste
Paste content
Up to 100 KB of text. BBCode formatting is supported.
Title
- optional
Content
B
I
U
S
</>
Colors ↓
Sizes ↓
Size 1
Size 2
Size 3
Size 4
Size 5
Size 6
Size 7
import net.lingala.zip4j.io.inputstream.ZipInputStream;\r\nimport net.lingala.zip4j.model.LocalFileHeader;\r\n\r\nimport java.io.FileInputStream;\r\nimport java.io.FileOutputStream;\r\nimport java.io.File;\r\nimport java.io.IOException;\r\n\r\npublic class SampleClass{\r\n \r\n public static void main(String[] args)\r\n throws IOException{\r\n LocalFileHeader lfh = null;\r\n byte[] buffer = new byte[3072];\r\n \r\n FileInputStream fis = \r\n new FileInputStream(new File(\"myzip.zip\"));\r\n try(ZipInputStream zis = \r\n new ZipInputStream(fis, \"password\".toCharArray())){\r\n \r\n while((lfh = zis.getNextEntry()) != null){\r\n File extractedFile = new File(lfh.getFileName());\r\n \r\n try(FileOutputStream fos = new \r\n FileOutputStream(\"extracted/\"+extractedFile)){\r\n \r\n int len = 0;\r\n while((len = zis.read(buffer)) != -1)\r\n fos.write(buffer);\r\n }\r\n }\r\n }\r\n }\r\n}
Password
Anyone with the link will still need this password to view.
Expires
1 hour
3 hours
6 hours
12 hours
24 hours
48 hours
72 hours
Sign in to enable "Never expires".
Create paste
Please verify you are human
Cancel