- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.zeroturnaround.zip.ZipUtil.iterate()
方法的一些代码示例,展示了ZipUtil.iterate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipUtil.iterate()
方法的具体详情如下:
包路径:org.zeroturnaround.zip.ZipUtil
类名称:ZipUtil
方法名:iterate
[英]Reads the given ZIP file and executes the given action for each entry.
For each entry the corresponding input stream is also passed to the action. If you want to stop the loop then throw a ZipBreakException.
[中]读取给定的ZIP文件,并对每个条目执行给定的操作。
对于每个条目,相应的输入流也会传递给操作。如果要停止循环,请抛出ZipBreakException。
代码示例来源:origin: zeroturnaround/zt-zip
/**
* See {@link #iterate(InputStream, ZipEntryCallback, Charset)}. This method
* is a shorthand for a version where no Charset is specified.
*
* @param is
* input ZIP stream (it will not be closed automatically).
* @param action
* action to be called for each entry.
*
* @see ZipEntryCallback
* @see #iterate(File, ZipEntryCallback)
*/
public static void iterate(InputStream is, ZipEntryCallback action) {
iterate(is, action, null);
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Reads the given ZIP file and executes the given action for each entry.
* <p>
* For each entry the corresponding input stream is also passed to the action. If you want to stop the loop
* then throw a ZipBreakException.
*
* @param zip
* input ZIP file.
* @param action
* action to be called for each entry.
*
* @see ZipEntryCallback
* @see #iterate(File, ZipInfoCallback)
*/
public static void iterate(File zip, ZipEntryCallback action) {
iterate(zip, action, null);
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* See @link{ {@link #iterate(InputStream, ZipEntryCallback, Charset)}. It is a
* shorthand where no Charset is specified.
*
* @param is
* input ZIP stream (it will not be closed automatically).
* @param entryNames
* names of entries to iterate
* @param action
* action to be called for each entry.
*
* @see ZipEntryCallback
* @see #iterate(File, String[], ZipEntryCallback)
*/
public static void iterate(InputStream is, String[] entryNames, ZipEntryCallback action) {
iterate(is, entryNames, action, null);
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Reads the given ZIP file and executes the given action for each given entry.
* <p>
* For each given entry the corresponding input stream is also passed to the action. If you want to stop the loop then throw a ZipBreakException.
*
* @param zip
* input ZIP file.
* @param entryNames
* names of entries to iterate
* @param action
* action to be called for each entry.
*
* @see ZipEntryCallback
* @see #iterate(File, String[], ZipInfoCallback)
*/
public static void iterate(File zip, String[] entryNames, ZipEntryCallback action) {
iterate(zip, entryNames, action, null);
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Copies all entries from one ZIP file to another.
*
* @param zip
* source ZIP file.
* @param out
* target ZIP stream.
*/
private static void copyEntries(File zip, final ZipOutputStream out) {
// this one doesn't call copyEntries with ignoredEntries, because that has poorer performance
final Set<String> names = new HashSet<String>();
iterate(zip, new ZipEntryCallback() {
public void process(InputStream in, ZipEntry zipEntry) throws IOException {
String entryName = zipEntry.getName();
if (names.add(entryName)) {
ZipEntryUtil.copyEntry(zipEntry, in, out);
}
else if (log.isDebugEnabled()) {
log.debug("Duplicate entry: {}", entryName);
}
}
});
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Copies all entries from one ZIP stream to another.
*
* @param is
* source stream (contains ZIP file).
* @param out
* target ZIP stream.
*/
private static void copyEntries(InputStream is, final ZipOutputStream out) {
// this one doesn't call copyEntries with ignoredEntries, because that has poorer performance
final Set<String> names = new HashSet<String>();
iterate(is, new ZipEntryCallback() {
public void process(InputStream in, ZipEntry zipEntry) throws IOException {
String entryName = zipEntry.getName();
if (names.add(entryName)) {
ZipEntryUtil.copyEntry(zipEntry, in, out);
}
else if (log.isDebugEnabled()) {
log.debug("Duplicate entry: {}", entryName);
}
}
});
}
代码示例来源:origin: jphp-group/jphp
@Signature
public void read(final Environment env, String path, final Invoker callback) {
ZipUtil.iterate(zipFile, new String[]{path}, new ZipEntryCallback() {
@Override
public void process(InputStream in, ZipEntry zipEntry) throws IOException {
callback.callAny(zipEntryToArray(zipEntry), new MiscStream(env, in));
}
});
}
代码示例来源:origin: jphp-group/jphp
@Signature
public void readAll(final Environment env, final Invoker callback) {
ZipUtil.iterate(zipFile, new ZipEntryCallback() {
@Override
public void process(InputStream in, ZipEntry zipEntry) throws IOException {
callback.callAny(zipEntryToArray(zipEntry), new MiscStream(env, in));
}
});
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Unwraps a ZIP file to the given directory shaving of root dir.
* If there are multiple root dirs or entries in the root of zip,
* ZipException is thrown.
* <p>
* The output directory must not be a file.
*
* @param zip
* input ZIP file.
* @param outputDir
* output directory (created automatically if not found).
* @param mapper
* call-back for renaming the entries.
*/
public static void unwrap(File zip, File outputDir, NameMapper mapper) {
log.debug("Unwrapping '{}' into '{}'.", zip, outputDir);
iterate(zip, new Unwrapper(outputDir, mapper));
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Unwraps a ZIP file to the given directory shaving of root dir.
* If there are multiple root dirs or entries in the root of zip,
* ZipException is thrown.
* <p>
* The output directory must not be a file.
*
* @param is
* inputstream for ZIP file.
* @param outputDir
* output directory (created automatically if not found).
* @param mapper
* call-back for renaming the entries.
*/
public static void unwrap(InputStream is, File outputDir, NameMapper mapper) {
log.debug("Unwrapping {} into '{}'.", is, outputDir);
iterate(is, new Unwrapper(outputDir, mapper));
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Unpacks a ZIP file to the given directory.
* <p>
* The output directory must not be a file.
*
* @param zip
* input ZIP file.
* @param outputDir
* output directory (created automatically if not found).
* @param mapper
* call-back for renaming the entries.
* @param charset
* charset used to process the zip file
*/
public static void unpack(File zip, File outputDir, NameMapper mapper, Charset charset) {
log.debug("Extracting '{}' into '{}'.", zip, outputDir);
iterate(zip, new Unpacker(outputDir, mapper), charset);
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Unpacks a ZIP stream to the given directory.
* <p>
* The output directory must not be a file.
*
* @param is
* inputstream for ZIP file.
* @param outputDir
* output directory (created automatically if not found).
* @param mapper
* call-back for renaming the entries.
* @param charset
* charset to use when unpacking the stream
*/
public static void unpack(InputStream is, File outputDir, NameMapper mapper, Charset charset) {
log.debug("Extracting {} into '{}'.", is, outputDir);
iterate(is, new Unpacker(outputDir, mapper), charset);
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Unpacks a ZIP file to the given directory using a specific Charset
* for the input file.
*
* <p>
* The output directory must not be a file.
*
* @param zip
* input ZIP file.
* @param outputDir
* output directory (created automatically if not found).
* @param mapper
* call-back for renaming the entries.
*/
public static void unpack(File zip, File outputDir, NameMapper mapper) {
log.debug("Extracting '{}' into '{}'.", zip, outputDir);
iterate(zip, new Unpacker(outputDir, mapper));
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Repacks a provided ZIP input stream into a ZIP file with a given compression level.
* <p>
*
* @param is
* ZIP input stream.
* @param dstZip
* destination ZIP file.
* @param compressionLevel
* compression level.
*/
public static void repack(InputStream is, File dstZip, int compressionLevel) {
log.debug("Repacking from input stream into '{}'.", dstZip);
RepackZipEntryCallback callback = new RepackZipEntryCallback(dstZip, compressionLevel);
try {
iterate(is, callback);
}
finally {
callback.closeStream();
}
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Repacks a provided ZIP file into a new ZIP with a given compression level.
* <p>
*
* @param srcZip
* source ZIP file.
* @param dstZip
* destination ZIP file.
* @param compressionLevel
* compression level.
*/
public static void repack(File srcZip, File dstZip, int compressionLevel) {
log.debug("Repacking '{}' into '{}'.", srcZip, dstZip);
RepackZipEntryCallback callback = new RepackZipEntryCallback(dstZip, compressionLevel);
try {
iterate(srcZip, callback);
}
finally {
callback.closeStream();
}
}
代码示例来源:origin: jphp-group/jphp
@Signature
public Memory stat(String path) {
final ArrayMemory[] result = new ArrayMemory[1];
ZipUtil.iterate(zipFile, new String[] { path }, new ZipInfoCallback() {
@Override
public void process(ZipEntry zipEntry) throws IOException {
result[0] = zipEntryToArray(zipEntry);
}
});
return result[0].toConstant();
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Copies an existing ZIP file and transforms the given entries in it.
*
* @param zip
* an existing ZIP file (only read).
* @param entries
* ZIP entry transformers.
* @param destZip
* new ZIP file created.
* @return <code>true</code> if at least one entry was replaced.
*/
public static boolean transformEntries(File zip, ZipEntryTransformerEntry[] entries, File destZip) {
if (log.isDebugEnabled())
log.debug("Copying '" + zip + "' to '" + destZip + "' and transforming entries " + Arrays.asList(entries) + ".");
try {
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(destZip)));
try {
TransformerZipEntryCallback action = new TransformerZipEntryCallback(Arrays.asList(entries), out);
iterate(zip, action);
return action.found();
}
finally {
IOUtils.closeQuietly(out);
}
}
catch (IOException e) {
throw ZipExceptionUtil.rethrow(e);
}
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Reads the given ZIP stream and executes the given action for a single
* entry.
*
* @param is
* input ZIP stream (it will not be closed automatically).
* @param name
* entry name.
* @param action
* action to be called for this entry.
* @return <code>true</code> if the entry was found, <code>false</code> if the
* entry was not found.
*
* @see ZipEntryCallback
*/
public static boolean handle(InputStream is, String name, ZipEntryCallback action) {
SingleZipEntryCallback helper = new SingleZipEntryCallback(name, action);
iterate(is, helper);
return helper.found();
}
代码示例来源:origin: jphp-group/jphp
@Signature
public Memory statAll() {
final ArrayMemory result = new ArrayMemory();
ZipUtil.iterate(zipFile, new ZipInfoCallback() {
@Override
public void process(ZipEntry zipEntry) throws IOException {
result.put(zipEntry.getName(), zipEntryToArray(zipEntry));
}
});
return result.toConstant();
}
代码示例来源:origin: zeroturnaround/zt-zip
/**
* Copies an existing ZIP file and transforms the given entries in it.
*
* @param is
* a ZIP input stream.
* @param entries
* ZIP entry transformers.
* @param os
* a ZIP output stream.
* @return <code>true</code> if at least one entry was replaced.
*/
public static boolean transformEntries(InputStream is, ZipEntryTransformerEntry[] entries, OutputStream os) {
if (log.isDebugEnabled())
log.debug("Copying '" + is + "' to '" + os + "' and transforming entries " + Arrays.asList(entries) + ".");
try {
ZipOutputStream out = new ZipOutputStream(os);
TransformerZipEntryCallback action = new TransformerZipEntryCallback(Arrays.asList(entries), out);
iterate(is, action);
// Finishes writing the contents of the ZIP output stream without closing
// the underlying stream.
out.finish();
return action.found();
}
catch (IOException e) {
throw ZipExceptionUtil.rethrow(e);
}
}
本文整理了Java中jodd.io.ZipUtil.addToZip()方法的一些代码示例,展示了ZipUtil.addToZip()的具体用法。这些代码示例主要来源于Github/Stackover
本文整理了Java中jodd.io.ZipUtil.addFolderToZip()方法的一些代码示例,展示了ZipUtil.addFolderToZip()的具体用法。这些代码示例主要来源于Gith
本文整理了Java中jodd.io.ZipUtil.close()方法的一些代码示例,展示了ZipUtil.close()的具体用法。这些代码示例主要来源于Github/Stackoverflow/M
本文整理了Java中jodd.io.ZipUtil.unzip()方法的一些代码示例,展示了ZipUtil.unzip()的具体用法。这些代码示例主要来源于Github/Stackoverflow/M
本文整理了Java中jodd.io.ZipUtil.zlib()方法的一些代码示例,展示了ZipUtil.zlib()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Mav
本文整理了Java中jodd.io.ZipUtil.gzip()方法的一些代码示例,展示了ZipUtil.gzip()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Mav
本文整理了Java中jodd.io.ZipUtil.ungzip()方法的一些代码示例,展示了ZipUtil.ungzip()的具体用法。这些代码示例主要来源于Github/Stackoverflow
本文整理了Java中jodd.io.ZipUtil.zip()方法的一些代码示例,展示了ZipUtil.zip()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven
本文整理了Java中org.zeroturnaround.zip.ZipUtil.pack()方法的一些代码示例,展示了ZipUtil.pack()的具体用法。这些代码示例主要来源于Github/St
本文整理了Java中org.zeroturnaround.zip.ZipUtil.unpackEntry()方法的一些代码示例,展示了ZipUtil.unpackEntry()的具体用法。这些代码示例
本文整理了Java中org.zeroturnaround.zip.ZipUtil.removeEntry()方法的一些代码示例,展示了ZipUtil.removeEntry()的具体用法。这些代码示例
本文整理了Java中org.zeroturnaround.zip.ZipUtil.packEntries()方法的一些代码示例,展示了ZipUtil.packEntries()的具体用法。这些代码示例
本文整理了Java中org.zeroturnaround.zip.ZipUtil.containsEntry()方法的一些代码示例,展示了ZipUtil.containsEntry()的具体用法。这些
本文整理了Java中org.zeroturnaround.zip.ZipUtil.unpack()方法的一些代码示例,展示了ZipUtil.unpack()的具体用法。这些代码示例主要来源于Githu
本文整理了Java中org.zeroturnaround.zip.ZipUtil.addOrReplaceEntries()方法的一些代码示例,展示了ZipUtil.addOrReplaceEntri
本文整理了Java中org.zeroturnaround.zip.ZipUtil.iterate()方法的一些代码示例,展示了ZipUtil.iterate()的具体用法。这些代码示例主要来源于Git
本文整理了Java中org.openl.util.ZipUtils.archive()方法的一些代码示例,展示了ZipUtils.archive()的具体用法。这些代码示例主要来源于Github/St
本文整理了Java中org.openl.util.ZipUtils.extractAll()方法的一些代码示例,展示了ZipUtils.extractAll()的具体用法。这些代码示例主要来源于Git
本文整理了Java中org.mule.tck.ZipUtils.compress()方法的一些代码示例,展示了ZipUtils.compress()的具体用法。这些代码示例主要来源于Github/St
本文整理了Java中aQute.lib.zip.ZipUtil.setModifiedTime()方法的一些代码示例,展示了ZipUtil.setModifiedTime()的具体用法。这些代码示例主
我是一名优秀的程序员,十分优秀!