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.model.FileHeader;\r\nimport net.lingala.zip4j.ZipFile;\r\nimport net.lingala.zip4j.exception.ZipException;\r\nimport java.io.InputStream;\r\nimport java.io.IOException;\r\nimport java.io.BufferedInputStream;\r\nimport java.io.ByteArrayOutputStream;\r\n\r\npublic class SampleClass{\r\n\r\n public static void main(String[] args)\r\n throws ZipException,\r\n IOException{\r\n ZipFile zip = null;\r\n \r\n try{\r\n zip = new ZipFile\r\n (\"myzip.zip\");\r\n FileHeader header = \r\n zip.getFileHeader(\"img.jpg\");\r\n \r\n try(BufferedInputStream bif =\r\n new BufferedInputStream(zip.getInputStream(header));\r\n ByteArrayOutputStream baos = \r\n new ByteArrayOutputStream()){\r\n \r\n bif.transferTo(baos);\r\n for(byte b : baos.toByteArray())\r\n System.out.print(b + \" \");\r\n \r\n }\r\n }\r\n finally{\r\n if(zip != null)\r\n zip.close();\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