- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.tools.zip.ZipOutputStream.putNextEntry()
方法的一些代码示例,展示了ZipOutputStream.putNextEntry()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipOutputStream.putNextEntry()
方法的具体详情如下:
包路径:org.apache.tools.zip.ZipOutputStream
类名称:ZipOutputStream
方法名:putNextEntry
暂无
代码示例来源:origin: jenkinsci/jenkins
@Override
public void putNextEntry(ZipEntry ze) throws IOException {
ze.setTime(dirTime+1999); // roundup
super.putNextEntry(ze);
}
}) {
代码示例来源:origin: apache/hive
public static void zip(String parentDir, String[] inputFiles, String outputFile)
throws IOException {
ZipOutputStream output = null;
try {
output = new ZipOutputStream(new FileOutputStream(new File(parentDir, outputFile)));
for (int i = 0; i < inputFiles.length; i++) {
File f = new File(parentDir, inputFiles[i]);
FileInputStream input = new FileInputStream(f);
output.putNextEntry(new ZipEntry(inputFiles[i]));
try {
IOUtils.copy(input, output);
} finally {
input.close();
}
}
} finally {
org.apache.hadoop.io.IOUtils.closeStream(output);
}
}
代码示例来源:origin: jenkinsci/jenkins
if (mode!=-1) dirZipEntry.setUnixMode(mode);
dirZipEntry.setTime(f.lastModified());
zip.putNextEntry(dirZipEntry);
zip.closeEntry();
} else {
if (mode!=-1) fileZipEntry.setUnixMode(mode);
fileZipEntry.setTime(f.lastModified());
zip.putNextEntry(fileZipEntry);
try (InputStream in = Files.newInputStream(f.toPath())) {
int len;
代码示例来源:origin: jenkinsci/jenkins
VirtualFile f = dir.child(n);
e.setTime(f.lastModified());
zos.putNextEntry(e);
try (InputStream in = f.open()) {
IOUtils.copy(in, zos);
代码示例来源:origin: org.apache.ant/ant
zOut.putNextEntry(ze);
代码示例来源:origin: org.apache.ant/ant
zOut.putNextEntry(ze);
代码示例来源:origin: sanluan/PublicCMS
/**
* @param file
* @param out
* @param basedir
* @throws IOException
*/
private static void compress(Path sourceFilePath, ZipOutputStream out, String basedir) throws IOException {
if (Files.isDirectory(sourceFilePath)) {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(sourceFilePath);) {
for (Path entry : stream) {
BasicFileAttributes attrs = Files.readAttributes(entry, BasicFileAttributes.class);
String fullName = Constants.BLANK.equals(basedir) ? entry.toFile().getName()
: basedir + Constants.SEPARATOR + entry.toFile().getName();
if (attrs.isDirectory()) {
ZipEntry zipEntry = new ZipEntry(fullName + Constants.SEPARATOR);
out.putNextEntry(zipEntry);
compress(entry, out, fullName);
} else {
compressFile(entry.toFile(), out, fullName);
}
}
} catch (IOException e) {
}
} else {
compressFile(sourceFilePath.toFile(), out, sourceFilePath.toFile().getName());
}
}
代码示例来源:origin: sanluan/PublicCMS
/**
* @param file
* @param out
* @param basedir
* @throws IOException
*/
private static void compress(Path sourceFilePath, ZipOutputStream out, String basedir) throws IOException {
if (Files.isDirectory(sourceFilePath)) {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(sourceFilePath);) {
for (Path entry : stream) {
BasicFileAttributes attrs = Files.readAttributes(entry, BasicFileAttributes.class);
String fullName = Constants.BLANK.equals(basedir) ? entry.toFile().getName()
: basedir + Constants.SEPARATOR + entry.toFile().getName();
if (attrs.isDirectory()) {
ZipEntry zipEntry = new ZipEntry(fullName + Constants.SEPARATOR);
out.putNextEntry(zipEntry);
compress(entry, out, fullName);
} else {
compressFile(entry.toFile(), out, fullName);
}
}
} catch (IOException e) {
}
} else {
compressFile(sourceFilePath.toFile(), out, sourceFilePath.toFile().getName());
}
}
代码示例来源:origin: sanluan/PublicCMS
/**
* @param file
* @param out
* @param basedir
* @throws IOException
*/
private static void compressFile(File file, ZipOutputStream out, String fullName) throws IOException {
if (CommonUtils.notEmpty(file)) {
ZipEntry entry = new ZipEntry(fullName);
entry.setTime(file.lastModified());
out.putNextEntry(entry);
try (FileInputStream fis = new FileInputStream(file);) {
StreamUtils.copy(fis, out);
}
}
}
代码示例来源:origin: sanluan/PublicCMS
/**
* @param file
* @param out
* @param basedir
* @throws IOException
*/
private static void compressFile(File file, ZipOutputStream out, String fullName) throws IOException {
if (CommonUtils.notEmpty(file)) {
ZipEntry entry = new ZipEntry(fullName);
entry.setTime(file.lastModified());
out.putNextEntry(entry);
try (FileInputStream fis = new FileInputStream(file);) {
StreamUtils.copy(fis, out);
}
}
}
代码示例来源:origin: com.github.tianjing/tgtools.core
/**
* @param p_EntryName
* @throws APPErrorException
*/
private void addZipEntry(String p_EntryName) throws APPErrorException {
ZipEntry zipEntry = new ZipEntry(p_EntryName);
try {
m_ZipOutputStream.putNextEntry(zipEntry);
} catch (IOException e) {
e.printStackTrace();
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
@Override
public void putNextEntry(ZipEntry ze) throws IOException {
ze.setTime(dirTime+1999); // roundup
super.putNextEntry(ze);
}
}) {
代码示例来源:origin: com.github.tianjing/tgtools.core
private static void writeRecursive(ZipOutputStream zos,
BufferedOutputStream bo,String p_FileName,byte[] p_FileData)
throws IOException, FileNotFoundException {
ZipEntry zipEntry = new ZipEntry(p_FileName);
zos.putNextEntry(zipEntry);
bo.write(p_FileData);
bo.flush();
}
/**
代码示例来源:origin: gradle.plugin.com.bettycc.umengauto/core
private static void writePack(Map<ZipEntry, byte[]> readZipAllEntry, ZipFile file, String path, String channel)
throws Exception {
ZipOutputStream zot = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(path)));
Iterator<ZipEntry> iterator = readZipAllEntry.keySet().iterator();
while (iterator.hasNext()) {
ZipEntry entry = iterator.next();
zot.putNextEntry(entry);
byte[] data = readZipAllEntry.get(entry);
zot.write(data, 0, data.length);
// System.out.println(entry);
// System.out.println(entry.getSize() + " ," +
// entry.getCompressedSize() + "," + data.length);
zot.closeEntry();
}
zot.putNextEntry(new ZipEntry("META-INF/channel_" + channel));
zot.closeEntry();
zot.close();
}
代码示例来源:origin: org.apache.hive/hive-common
public static void zip(String parentDir, String[] inputFiles, String outputFile)
throws IOException {
ZipOutputStream output = null;
try {
output = new ZipOutputStream(new FileOutputStream(new File(parentDir, outputFile)));
for (int i = 0; i < inputFiles.length; i++) {
File f = new File(parentDir, inputFiles[i]);
FileInputStream input = new FileInputStream(f);
output.putNextEntry(new ZipEntry(inputFiles[i]));
try {
IOUtils.copy(input, output);
} finally {
input.close();
}
}
} finally {
org.apache.hadoop.io.IOUtils.closeStream(output);
}
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
public void visit(File f, String relativePath) throws IOException {
if(f.isDirectory()) {
ZipEntry dirZipEntry = new ZipEntry(relativePath+'/');
// Setting this bit explicitly is needed by some unzipping applications (see HUDSON-3294).
dirZipEntry.setExternalAttributes(BITMASK_IS_DIRECTORY);
zip.putNextEntry(dirZipEntry);
zip.closeEntry();
} else {
zip.putNextEntry(new ZipEntry(relativePath));
FileInputStream in = new FileInputStream(f);
int len;
while((len=in.read(buf))>0)
zip.write(buf,0,len);
in.close();
zip.closeEntry();
}
entriesWritten++;
}
代码示例来源:origin: hudson/hudson-2.x
public void visit(File f, String relativePath) throws IOException {
if(f.isDirectory()) {
ZipEntry dirZipEntry = new ZipEntry(relativePath+'/');
// Setting this bit explicitly is needed by some unzipping applications (see HUDSON-3294).
dirZipEntry.setExternalAttributes(BITMASK_IS_DIRECTORY);
zip.putNextEntry(dirZipEntry);
zip.closeEntry();
} else {
zip.putNextEntry(new ZipEntry(relativePath));
FileInputStream in = new FileInputStream(f);
int len;
while((len=in.read(buf))>0)
zip.write(buf,0,len);
in.close();
zip.closeEntry();
}
entriesWritten++;
}
代码示例来源:origin: hyperic/hq
private void addFile (org.apache.tools.zip.ZipEntry entry,
ZipOutputStream zip_out,
InputStream in,
long size,
byte[] buf) throws IOException {
entry.setTime(System.currentTimeMillis());
entry.setSize(size);
zip_out.putNextEntry(entry);
FileUtil.copyStream(in, zip_out, buf);
zip_out.closeEntry();
}
}
代码示例来源:origin: org.gradle/gradle-core
private void visitDir(FileCopyDetails dirDetails) {
try {
// Trailing slash in name indicates that entry is a directory
ZipEntry archiveEntry = new ZipEntry(dirDetails.getRelativePath().getPathString() + '/');
archiveEntry.setTime(getArchiveTimeFor(dirDetails));
archiveEntry.setUnixMode(UnixStat.DIR_FLAG | dirDetails.getMode());
zipOutStr.putNextEntry(archiveEntry);
zipOutStr.closeEntry();
} catch (Exception e) {
throw new GradleException(String.format("Could not add %s to ZIP '%s'.", dirDetails, zipFile), e);
}
}
}
代码示例来源:origin: org.gradle/gradle-core
private void visitFile(FileCopyDetails fileDetails) {
try {
ZipEntry archiveEntry = new ZipEntry(fileDetails.getRelativePath().getPathString());
archiveEntry.setTime(getArchiveTimeFor(fileDetails));
archiveEntry.setUnixMode(UnixStat.FILE_FLAG | fileDetails.getMode());
zipOutStr.putNextEntry(archiveEntry);
fileDetails.copyTo(zipOutStr);
zipOutStr.closeEntry();
} catch (Exception e) {
throw new GradleException(String.format("Could not add %s to ZIP '%s'.", fileDetails, zipFile), e);
}
}
我正在尝试使用 java.util.net 修改 zip 文件中的文件由于无法直接修改文件,而且我只想修改一个文件,所以我只创建了一个基本上包含模板内容的新 zip 文件并替换了特定文件,至少这是计划
本文整理了Java中java.util.zip.ZipOutputStream.putNextEntry()方法的一些代码示例,展示了ZipOutputStream.putNextEntry()的具体
本文整理了Java中org.apache.tools.zip.ZipOutputStream.putNextEntry()方法的一些代码示例,展示了ZipOutputStream.putNextEnt
本文整理了Java中de.schlichtherle.truezip.zip.ZipOutputStream.putNextEntry()方法的一些代码示例,展示了ZipOutputStream.pu
本文整理了Java中net.lingala.zip4j.io.ZipOutputStream.putNextEntry()方法的一些代码示例,展示了ZipOutputStream.putNextEnt
因此,我创建了一个 zip 并通过创建以“\”结尾的 zip 条目在 zip 文件中创建了一个新的子文件夹。我将如何写入子文件夹? 我的问题是我在 for 循环中对 ZipOutputStream 进
我是一名优秀的程序员,十分优秀!