本文整理匯總了Java中java.util.zip.ZipOutputStream.setComment方法的典型用法代碼示例。如果您正苦於以下問題:Java ZipOutputStream.setComment方法的具體用法?Java ZipOutputStream.setComment怎麽用?Java ZipOutputStream.setComment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.zip.ZipOutputStream
的用法示例。
在下文中一共展示了ZipOutputStream.setComment方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createBugReport
import java.util.zip.ZipOutputStream; //導入方法依賴的package包/類
public static void createBugReport(File reportFile, Throwable exception, String userMessage, Process process,
String logMessage, File[] attachments) throws IOException {
ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(reportFile));
zipOut.setComment("RapidMiner bug report - generated " + new Date());
write("message.txt", "User message", userMessage, zipOut);
write("_process.xml", "Process as in memory.", process.getRootOperator().getXML(false), zipOut);
if (process.getProcessLocation() != null) {
try {
String contents = process.getProcessLocation().getRawXML();
write(process.getProcessLocation().getShortName(), "Raw process file in repository.", contents, zipOut);
} catch (Throwable t) {
write(process.getProcessLocation().getShortName(), "Raw process file in repository.",
"could not read: " + t, zipOut);
}
}
write("_log.txt", "Log message", logMessage, zipOut);
write("_properties.txt", "System properties, information about java version and operating system", getProperties(),
zipOut);
write("_exception.txt", "Exception stack trace", getStackTrace(exception), zipOut);
for (File attachment : attachments) {
writeFile(attachment, zipOut);
}
zipOut.close();
}
示例2: zipFiles
import java.util.zip.ZipOutputStream; //導入方法依賴的package包/類
public static void zipFiles(Collection<File> resFileList, File zipFile, String comment) throws IOException {
ZipOutputStream zipout = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile), 1048576));
for (File resFile : resFileList) {
zipFile(resFile, zipout, "");
}
zipout.setComment(comment);
zipout.close();
}
示例3: zipFiles
import java.util.zip.ZipOutputStream; //導入方法依賴的package包/類
/**
* 批量壓縮文件(夾)
*
* @param resFileList 要壓縮的文件(夾)列表
* @param zipFile 生成的壓縮文件
* @param comment 壓縮文件的注釋
* @throws IOException 當壓縮過程出錯時拋出
*/
public static void zipFiles(Collection<File> resFileList, File zipFile, String comment)
throws IOException {
ZipOutputStream zipout = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(
zipFile), BUFF_SIZE));
for (File resFile : resFileList) {
zipFile(resFile, zipout, "");
}
zipout.setComment(comment);
zipout.close();
}
示例4: zipFiles
import java.util.zip.ZipOutputStream; //導入方法依賴的package包/類
/**
* 批量壓縮文件(夾)
*
* @param resFileList 要壓縮的文件(夾)列表
* @param zipFile 生成的壓縮文件
* @param comment 壓縮文件的注釋
* @throws IOException 當壓縮過程出錯時拋出
*/
public static void zipFiles(Collection<File> resFileList, File zipFile, String comment)
throws IOException {
ZipOutputStream zipout = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(
zipFile), BUFF_SIZE));
for (File resFile : resFileList) {
zipFile(resFile, zipout, "");
}
zipout.setComment(comment);
zipout.close();
}
示例5: writeToZIPComment
import java.util.zip.ZipOutputStream; //導入方法依賴的package包/類
private static String writeToZIPComment(ZipOutputStream zip, String customer, String key) {
zip.setComment(AES.encrypt("WMID: " + customer, key));
System.out.println("Injected encrypted customer name into zip comment");
return "Injected encrypted customer name into zip comment";
}