?? zip解壓縮提取1文件.java
字號:
package 壓縮文件夾.api測試;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
public class zip解壓縮提取1文件
{
public static void main(String[] args)
{
try {
// Open the ZIP file
String inFilename = "d://ok.zip";
ZipInputStream in = new ZipInputStream(new FileInputStream(inFilename));
// Get the first entry
ZipEntry entry = in.getNextEntry();
// Open the output file
String outFilename = "c:\\aa.log";
OutputStream out = new FileOutputStream(outFilename);
// Transfer bytes from the ZIP file to the output file
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0)
{
out.write(buf, 0, len);
}
// Close the streams
out.close();
in.close();
}
catch (IOException e)
{
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -