Java文件解壓縮實例詳解2016
為了幫助廣大考試新手們更加順利地複習備考,小編整理了JAVA文件解壓縮的相關實例,希望能夠對大家學習java有所幫助。
Java實現壓縮文件的'解壓縮操作,缺點是壓縮文件內不能含有文件名為中文的的文件,否則會出現如下錯誤:
Exception in thread "main" gALArgumentException: MALFORMED
at ring(Unknown Source)
at LOC(Unknown Source)
at extEntry(Unknown Source)
at ()
代碼:
package ;
import ;
import InputStream;
import OutputStream;
import tStream;
import utStream;
import ntry;
import ile;
import nputStream;
public class ZipFileDemo {
@SuppressWarnings("resource")
public static void main(String args[]) throws Exception {
File file = new File("d:" + rator + "");
File outFile = null;
ZipFile zipFile = new ZipFile(file);
ZipInputStream zipInput = new ZipInputStream(new FileInputStream(file));
ZipEntry entry = null;
InputStream input = null;
OutputStream out = null;
while ((entry = extEntry()) != null) {
tln("開始解壓縮" + ame() + "文件。。。");
outFile = new File("d:" + rator + ame());
if (!arentFile()ts()) {
arentFile()r();
}
if (!ts()) {
teNewFile();
}
input = nputStream(entry);
out = new FileOutputStream(outFile);
int temp = 0;
while ((temp = ()) != -1) {
//tln(temp);
e(temp);
}
e();
e();
}
tln("Done!");
}
}
-
Java考試格林模擬題
question14)whichofthefollowinglinesofcodewillcompilewithouterror1)inti=0;if(i){tln("hello");}2)booleanb=true;booleanb2=true;if(b==b2){tln("sotrue");}3)inti=1;intj=2;if(i==1||j==2)tln("ok");4)inti=1;intj=2;if(i==1&|j==2)tln("ok");questio...
-
java非對稱加密的源代碼(rsa)
java非對稱加密的源代碼rsa有哪些基本知識,下面yjbys小編為大家一一講解!鑑於rsa加密的重要性和相關源代碼的匱乏,經過整理特此貼出。需要下載。importer;importrity.*;importublicKeySpec;importrivateKeySpec;importlidKeySpecException;importrivateKey;impor...
-
java基礎面試題2017
Java平台是基於Java語言的平台。這樣的平台目前非常流行,因此微軟公司推出了與之競爭的平台以及模仿Java的C#語言。以下是關於java基礎面試題,希望大家認真閲讀!非技術問題研究比較深入的領域有哪些;對業內信息的關注渠道有哪些;最近都讀哪些書;自己最擅長的技術...
-
java認證考試科目設置
Java相關的認證有四個,分別是SCJP、SCWD、SCJD、SCAJ,考試時皆以英文出題,但在台灣SCJP考試可以選擇使用繁體中文版考題。這幾項認證考試的特點分述如下:SCJP(SunCertifiedJavaProgrammer):測試Java程序設計的觀念和能力,內容偏重於Java語法和JDK內容。共59題複選及...