當前位置:首頁 » 密碼管理 » javazip加密碼

javazip加密碼

發布時間: 2024-09-13 07:46:53

❶ 請大神幫忙解決一個用java壓縮一個zip壓縮格式位元組流中文內容亂碼問題!

這個問題我有點印象,好像是包的問題。好像不能用zip的那個,換另一個包就好了。具體我也不記得了

❷ 在線等回答,請速度,Java中實現對文件夾加密壓縮,就是說壓縮完後用解壓工具解壓時會提示輸入密碼。。

(1)網路傳輸狀況不好(如斷線過多,開的線程過多,伺服器人太多導致不能連接太多等)導致下載下來的文件損壞!
(2)站點提供的的RAR壓縮包本來就是損壞的(這個本站可以保證,所上傳的視頻及軟體等都經過好幾遍測試,絕對沒問題)。
(3)所使用的下載工具不夠完善,比如有的下載工具多開了幾個線程後,下載的收尾工作很慢,有些時候下載到99%時數據就不再傳輸了,一定要人工操作才能結束(先停止下載接著再開始)。筆者就碰到過好幾次這樣的情況。結果是文件下載下來以後解壓縮到快結束時CRC出錯。
解決方法:本站為防止這樣的事情發生,在每個壓縮包里又加了一個備份,防止因以上原因導致的下載後不能用,還得重新下載的問題,只要你下載下來的那個壓縮包里的備份是好的那就能把壓縮包里的文件恢復能用。
步驟一:雙擊打開需要解壓修復的壓縮包,選擇:工具——修復壓縮文件。
步驟二:出現下邊圖片的修復框,等待修復完成,關閉窗口及解壓縮窗口就可以了。
步驟三:這時你會發現你需要解壓的壓縮包旁邊多了一個壓縮包,名稱為:fixed.***(你下載的視頻名稱).rar ,這個壓縮包就是修復後的解壓縮包,如果修復成功,解壓這個名稱為:fixed.***(你下載的視頻名稱).rar 的壓縮包就可以了。
如果修復不成功,你再修復幾次看看,如果不行,只有再重新下載了

❸ java實現zip壓縮後的壓縮文件無內容怎麼辦

inputFileName, String )前面是要壓縮的源文件名
zipFileName是壓縮後的壓縮包.zip的名稱,
base是壓縮包裡面的文件名,源文件名壓縮後在壓縮包里名稱不一定和原來一樣了
那就是壓縮後的文件名稱和原來一樣不變!

❹ 如何在java中執行zip壓縮命令

publicclassZipFile{

publicstaticvoidmain(String[]args)throwsException{
//zip-rqq.zipWEB-INF-x'*.DS_Store'

ZipFilezipFile=newZipFile();
zipFile.start("zip-rqq.zipWEB-INF-x'*.DS_Store'");
}

privatesynchronizedvoidstart(Stringcmd)throwsException{
Processpro=null;
pro=Runtime.getRuntime().exec(cmd);
newDoOutput(pro.getInputStream()).start();
newDoOutput(pro.getErrorStream()).start();
}

{
publicInputStreamis;
publicDoOutput(InputStreamis){
this.is=is;
}
publicvoidrun(){
BufferedReaderbr=newBufferedReader(newInputStreamReader(this.is));
Stringstr=null;
StringBuildersb=newStringBuilder();
try{
while((str=br.readLine())!=null){
sb.append(str+" ");
}
System.out.println(sb.toString());
}catch(Exceptione){
e.printStackTrace();
}finally{
if(br!=null){
try{
br.close();
}catch(Exceptione){
e.printStackTrace();
}
}
}
}
}

}

❺ 如何使用java壓縮文件夾成為zip包

在JDK中有一個zip工具類:

java.util.zip Provides classes for reading and writing the standard ZIP and
GZIP file formats.

使用此類可以將文件夾或者多個文件進行打包壓縮操作。

在使用之前先了解關鍵方法:

ZipEntry(String name) Creates a new zip entry with the specified name.

使用ZipEntry的構造方法可以創建一個zip壓縮文件包的實例,然後通過ZipOutputStream將待壓縮的文件以流的形式寫進該壓縮包中。具體實現代碼如下:

importjava.io.BufferedInputStream;
importjava.io.BufferedOutputStream;
importjava.io.File;
importjava.io.FileInputStream;
importjava.io.FileNotFoundException;
importjava.io.FileOutputStream;
importjava.io.IOException;
importjava.util.zip.ZipEntry;
importjava.util.zip.ZipOutputStream;
/**
*將文件夾下面的文件
*打包成zip壓縮文件
*
*@authoradmin
*
*/
publicfinalclassFileToZip{

privateFileToZip(){}

/**
*將存放在sourceFilePath目錄下的源文件,打包成fileName名稱的zip文件,並存放到zipFilePath路徑下
*@paramsourceFilePath:待壓縮的文件路徑
*@paramzipFilePath:壓縮後存放路徑
*@paramfileName:壓縮後文件的名稱
*@return
*/
publicstaticbooleanfileToZip(StringsourceFilePath,StringzipFilePath,StringfileName){
booleanflag=false;
FilesourceFile=newFile(sourceFilePath);
FileInputStreamfis=null;
BufferedInputStreambis=null;
FileOutputStreamfos=null;
ZipOutputStreamzos=null;

if(sourceFile.exists()==false){
System.out.println("待壓縮的文件目錄:"+sourceFilePath+"不存在.");
}else{
try{
FilezipFile=newFile(zipFilePath+"/"+fileName+".zip");
if(zipFile.exists()){
System.out.println(zipFilePath+"目錄下存在名字為:"+fileName+".zip"+"打包文件.");
}else{
File[]sourceFiles=sourceFile.listFiles();
if(null==sourceFiles||sourceFiles.length<1){
System.out.println("待壓縮的文件目錄:"+sourceFilePath+"裡面不存在文件,無需壓縮.");
}else{
fos=newFileOutputStream(zipFile);
zos=newZipOutputStream(newBufferedOutputStream(fos));
byte[]bufs=newbyte[1024*10];
for(inti=0;i<sourceFiles.length;i++){
//創建ZIP實體,並添加進壓縮包
ZipEntryzipEntry=newZipEntry(sourceFiles[i].getName());
zos.putNextEntry(zipEntry);
//讀取待壓縮的文件並寫進壓縮包里
fis=newFileInputStream(sourceFiles[i]);
bis=newBufferedInputStream(fis,1024*10);
intread=0;
while((read=bis.read(bufs,0,1024*10))!=-1){
zos.write(bufs,0,read);
}
}
flag=true;
}
}
}catch(FileNotFoundExceptione){
e.printStackTrace();
thrownewRuntimeException(e);
}catch(IOExceptione){
e.printStackTrace();
thrownewRuntimeException(e);
}finally{
//關閉流
try{
if(null!=bis)bis.close();
if(null!=zos)zos.close();
}catch(IOExceptione){
e.printStackTrace();
thrownewRuntimeException(e);
}
}
}
returnflag;
}

publicstaticvoidmain(String[]args){
StringsourceFilePath="D:\TestFile";
StringzipFilePath="D:\tmp";
StringfileName="12700153file";
booleanflag=FileToZip.fileToZip(sourceFilePath,zipFilePath,fileName);
if(flag){
System.out.println("文件打包成功!");
}else{
System.out.println("文件打包失敗!");
}
}

}

❻ java 解壓zip 密碼

調用開源項目winzipaes。

AesZipFileDecrypter zipFile = new AesZipFileDecrypter( new File("doc/zipSpecificationAes.zip") );
ExtZipEntry entry = zipFile.getEntry( "zipSpecification.txt" );
zipFile.extractEntry( entry, new File("doc/zipSpecification.txt"), "foo" );

具體參考下面鏈接

熱點內容
什麼是伺服器機箱批發 發布:2024-09-18 10:26:10 瀏覽:195
sqlserver查看錶結構 發布:2024-09-18 09:56:18 瀏覽:37
伺服器生成錯誤是什麼意思 發布:2024-09-18 09:55:37 瀏覽:772
萬能鑰匙怎麼解密碼 發布:2024-09-18 09:17:12 瀏覽:382
麥塊和快吧電腦版里伺服器一樣嗎 發布:2024-09-18 09:14:05 瀏覽:201
phpmysql報錯 發布:2024-09-18 09:13:43 瀏覽:914
python數據保存 發布:2024-09-18 08:52:35 瀏覽:911
海康網路視頻伺服器原始ip 發布:2024-09-18 08:19:01 瀏覽:488
java教程視頻馬士兵 發布:2024-09-18 08:05:31 瀏覽:212
安卓耳機入耳安卓怎麼關閉 發布:2024-09-18 07:25:45 瀏覽:952