删除不必要的代码
This commit is contained in:
parent
ff4156d965
commit
a5f8f87f47
|
|
@ -213,55 +213,6 @@ public class GenController extends GenBaseController {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 将bytes流写入到本地
|
|
||||||
*
|
|
||||||
* @param bytes
|
|
||||||
*/
|
|
||||||
public boolean compress(byte[] bytes) {
|
|
||||||
try {
|
|
||||||
String dir = Config.getProfile() + "/hchyun.zip";
|
|
||||||
FileOutputStream fileOutputStream = new FileOutputStream(dir);
|
|
||||||
fileOutputStream.write(bytes);
|
|
||||||
fileOutputStream.flush();
|
|
||||||
fileOutputStream.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 压缩到文件
|
|
||||||
*
|
|
||||||
* @param sourceFileNames 源文件列表
|
|
||||||
* @param zipFileName 目标压缩文件
|
|
||||||
*/
|
|
||||||
public static void compress(List<String> sourceFileNames, String zipFileName) {
|
|
||||||
byte[] buf = new byte[1024];
|
|
||||||
File zipFile = new File(zipFileName);
|
|
||||||
try {
|
|
||||||
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile));
|
|
||||||
for (int i = 0; i < sourceFileNames.size(); i++) {
|
|
||||||
File sourceFile = new File(sourceFileNames.get(i));
|
|
||||||
FileInputStream fis = new FileInputStream(sourceFile);
|
|
||||||
zos.putNextEntry(new ZipEntry(sourceFile.getName()));
|
|
||||||
// logge.info("压缩当前文件:{}",sourceFile.getName());
|
|
||||||
int len;
|
|
||||||
while ((len = fis.read(buf)) > 0) {
|
|
||||||
zos.write(buf, 0, len);
|
|
||||||
}
|
|
||||||
zos.closeEntry();
|
|
||||||
fis.close();
|
|
||||||
}
|
|
||||||
zos.close();
|
|
||||||
System.out.println("压缩完成");
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.out.println(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成zip文件
|
* 生成zip文件
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue