當前位置: 首頁>>代碼示例>>Java>>正文


Java ZipException.getMessage方法代碼示例

本文整理匯總了Java中net.lingala.zip4j.exception.ZipException.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java ZipException.getMessage方法的具體用法?Java ZipException.getMessage怎麽用?Java ZipException.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.lingala.zip4j.exception.ZipException的用法示例。


在下文中一共展示了ZipException.getMessage方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startNextSplitFile

import net.lingala.zip4j.exception.ZipException; //導入方法依賴的package包/類
public RandomAccessFile startNextSplitFile() throws IOException, FileNotFoundException {
	String currZipFile = zipModel.getZipFile();
	String partFile = null;
	if (currSplitFileCounter == zipModel.getEndCentralDirRecord().getNoOfThisDisk()) {
		partFile = zipModel.getZipFile();
	} else {
		if (currSplitFileCounter >= 9) {
			partFile = currZipFile.substring(0, currZipFile.lastIndexOf(".")) + ".z" + (currSplitFileCounter + 1);
		} else {
			partFile = currZipFile.substring(0, currZipFile.lastIndexOf(".")) + ".z0" + (currSplitFileCounter + 1);
		}
	}
	currSplitFileCounter++;
	try {
		if(!Zip4jUtil.checkFileExists(partFile)) {
			throw new IOException("zip split file does not exist: " + partFile);
		}
	} catch (ZipException e) {
		throw new IOException(e.getMessage());
	}
	return new RandomAccessFile(partFile, InternalZipConstants.READ_MODE);
}
 
開發者ID:joielechong,項目名稱:Zip4jAndroid,代碼行數:23,代碼來源:UnzipEngine.java

示例2: close

import net.lingala.zip4j.exception.ZipException; //導入方法依賴的package包/類
/**
 * Closes the input stream and releases any resources.
 * If skipCRCCheck flag is set to true, this method skips CRC Check
 * of the extracted file
 * 
 * @throws IOException
 */
public void close(boolean skipCRCCheck) throws IOException {
	try {
		is.close();
		if (!skipCRCCheck && is.getUnzipEngine() != null) {
			is.getUnzipEngine().checkCRC();
		}
	} catch (ZipException e) {
		throw new IOException(e.getMessage());
	}
}
 
開發者ID:joielechong,項目名稱:Zip4jAndroid,代碼行數:18,代碼來源:ZipInputStream.java

示例3: encryptAndWrite

import net.lingala.zip4j.exception.ZipException; //導入方法依賴的package包/類
private void encryptAndWrite(byte[] b, int off, int len) throws IOException {
	if (encrypter != null) {
		try {
			encrypter.encryptData(b, off, len);
		} catch (ZipException e) {
			throw new IOException(e.getMessage());
		}
	}
	outputStream.write(b, off, len);
	totalBytesWritten += len;
	bytesWrittenForThisFile += len;
}
 
開發者ID:joielechong,項目名稱:Zip4jAndroid,代碼行數:13,代碼來源:CipherOutputStream.java

示例4: startNextSplitFile

import net.lingala.zip4j.exception.ZipException; //導入方法依賴的package包/類
private void startNextSplitFile() throws IOException {
	try {
		String zipFileWithoutExt = Zip4jUtil.getZipFileNameWithoutExt(outFile.getName());
		File currSplitFile = null;
		String zipFileName = zipFile.getAbsolutePath();
		String parentPath = (outFile.getParent() == null)?"":outFile.getParent() + System.getProperty("file.separator");
		
		if (currSplitFileCounter < 9) {
			currSplitFile = new File(parentPath + zipFileWithoutExt + ".z0" + (currSplitFileCounter + 1));
		} else {
			currSplitFile = new File(parentPath + zipFileWithoutExt + ".z" + (currSplitFileCounter + 1));
		}
		
		raf.close();
		
		if (currSplitFile.exists()) {
			throw new IOException("split file: " + currSplitFile.getName() + " already exists in the current directory, cannot rename this file");
		}
		
		if (!zipFile.renameTo(currSplitFile)) {
			throw new IOException("cannot rename newly created split file");
		}
		
		zipFile = new File(zipFileName);
		raf = new RandomAccessFile(zipFile, InternalZipConstants.WRITE_MODE);
		currSplitFileCounter++;
	} catch (ZipException e) {
		throw new IOException(e.getMessage());
	}
}
 
開發者ID:joielechong,項目名稱:Zip4jAndroid,代碼行數:31,代碼來源:SplitOutputStream.java

示例5: zipFiles

import net.lingala.zip4j.exception.ZipException; //導入方法依賴的package包/類
@Override
public String zipFiles(String zipFilePath, List<File> files, String filesRootPath, boolean includeRootPath) {

    String errorMessage = null;
    ZipParameters parameters = new ZipParameters();
    parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
    parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_FAST);
    parameters.setEncryptionMethod(Zip4jConstants.ENC_NO_ENCRYPTION);
    parameters.setDefaultFolderPath(filesRootPath);
    parameters.setIncludeRootFolder(includeRootPath);

    try {
        ZipFile zipFile = new ZipFile(zipFilePath);

        for (int i = 0; i < files.size(); i++) {
            File file = files.get(i);
            if (file.isFile()) {
                zipFile.addFile(file, parameters);
            }
            if (file.isDirectory()) {
                zipFile.addFolder(file, parameters);
            }
        }
    } catch (ZipException e) {
        errorMessage = e.getMessage();
    }

    return errorMessage;
}
 
開發者ID:rndsolutions,項目名稱:hawkcd,代碼行數:30,代碼來源:FileManagementService.java

示例6: unzipFile

import net.lingala.zip4j.exception.ZipException; //導入方法依賴的package包/類
@Override
public String unzipFile(String filePath, String destination) {

    String errorMessage = null;
    try {
        ZipFile zipFile = new ZipFile(filePath);
        zipFile.extractAll(destination);
    } catch (ZipException e) {
        errorMessage = e.getMessage();
    }

    return errorMessage;
}
 
開發者ID:rndsolutions,項目名稱:hawkcd,代碼行數:14,代碼來源:FileManagementService.java

示例7: unzipFile

import net.lingala.zip4j.exception.ZipException; //導入方法依賴的package包/類
@Override
public String unzipFile(String filePath, String destination) {

    String errorMessage = null;
    try {
        ZipFile zipFile = new ZipFile(filePath);
        zipFile.extractAll(destination);
    } catch (ZipException e) {
        e.printStackTrace();
        errorMessage = e.getMessage();
    }

    return errorMessage;
}
 
開發者ID:rndsolutions,項目名稱:hawkcd,代碼行數:15,代碼來源:FileManagementService.java

示例8: read

import net.lingala.zip4j.exception.ZipException; //導入方法依賴的package包/類
public int read(byte[] b, int off, int len) throws IOException {
	if (len > length - bytesRead) {
		len = (int) (length - bytesRead);
		if (len == 0) {
			checkAndReadAESMacBytes();
			return -1;
		}
	}
	
	if (unzipEngine.getDecrypter() instanceof AESDecrypter) {
		if (bytesRead + len  < length) {
			if (len % 16 != 0) {
				len = len - (len%16);
			}
		}
	}
	
	synchronized (raf) {
		count = raf.read(b, off, len);
		if ((count < len) && unzipEngine.getZipModel().isSplitArchive()) {
			raf.close();
			raf = unzipEngine.startNextSplitFile();
			if (count < 0) count = 0;
			int newlyRead = raf.read(b, count, len-count);
			if (newlyRead > 0)
				count += newlyRead;
		}
	}
	
	if (count > 0) {
		if (decrypter != null) {
			try {
				decrypter.decryptData(b, off, count);
			} catch (ZipException e) {
				throw new IOException(e.getMessage());
			}
		}
		bytesRead += count;
	}
	
	if (bytesRead >= length) {
		checkAndReadAESMacBytes();
	}
	
	return count;
}
 
開發者ID:joielechong,項目名稱:Zip4jAndroid,代碼行數:47,代碼來源:PartInputStream.java


注:本文中的net.lingala.zip4j.exception.ZipException.getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。