本文整理汇总了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";
}