本文整理了Java中net.java.trueupdate.core.zip.io.ZipFileStore
类的一些代码示例,展示了ZipFileStore
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipFileStore
类的具体详情如下:
包路径:net.java.trueupdate.core.zip.io.ZipFileStore
类名称:ZipFileStore
[英]A file based ZIP store.
[中]基于文件的ZIP存储。
代码示例来源:origin: net.java.trueupdate/trueupdate-installer-core
public ZipCommand(File zipFile,
File fileOrDirectory,
String entryName) {
this(new ZipFileStore(zipFile), fileOrDirectory, entryName);
}
代码示例来源:origin: net.java.trueupdate/trueupdate-installer-core
public UnzipCommand(File zipFile, File directory) {
this(new ZipFileStore(zipFile), directory);
}
代码示例来源:origin: net.java.trueupdate/trueupdate-core
public Builder input1(final @Nullable File input1) {
return input1(null == input1 ? null : new ZipFileStore(input1));
}
代码示例来源:origin: net.java.trueupdate/trueupdate-core
public Builder input2(final @Nullable File input2) {
return input2(null == input2 ? null : new ZipFileStore(input2));
}
代码示例来源:origin: net.java.trueupdate/trueupdate-core
public Builder delta(final @Nullable File file) {
return delta(null == file ? null : new ZipFileStore(file));
}
代码示例来源:origin: net.java.trueupdate/trueupdate-core
@Override public V on(File file) throws X, IOException {
return on(new ZipFileStore(file));
}
代码示例来源:origin: net.java.trueupdate/trueupdate-core
@Override public V on(File file) throws X, IOException {
return on(new ZipFileStore(file));
}
代码示例来源:origin: net.java.trueupdate/trueupdate-core
public Builder input(final @Nullable File file) {
return input(null == file ? null : new ZipFileStore(file));
}
代码示例来源:origin: net.java.trueupdate/trueupdate-installer-core
public static void unzip(final ZipSource source, final File directory)
throws IOException {
class UnzipTask implements ZipInputTask<Void, IOException> {
@Override public Void execute(final ZipInput input) throws IOException {
for (final ZipEntry entry : input) {
if (entry.isDirectory()) continue;
final File file = new File(directory, entry.getName());
file.getParentFile().mkdirs();
Copy.copy(new ZipEntrySource(entry, input),
new FileStore(file));
}
return null;
}
} // UnzipTask
ZipSources.execute(new UnzipTask()).on(source);
}
代码示例来源:origin: net.java.trueupdate/trueupdate-core
@Override
public void output(final ZipSink sink) throws IOException {
class Input1Task implements ZipInputTask<Void, IOException> {
public Void execute(final ZipInput input1) throws IOException {
class Input2Task implements ZipInputTask<Void, IOException> {
public Void execute(final ZipInput input2) throws IOException {
class DiffTask implements ZipOutputTask<Void, IOException> {
public Void execute(final ZipOutput delta) throws IOException {
new RawZipDiff() {
final MessageDigest digest = MessageDigests.create(
null != digestName ? digestName : "SHA-1");
protected MessageDigest digest() { return digest; }
protected ZipInput input1() { return input1; }
protected ZipInput input2() { return input2; }
}.output(delta);
return null;
}
} // DiffTask
return ZipSinks.execute(new DiffTask()).on(sink);
}
} // Input2Task
return ZipSources.execute(new Input2Task()).on(input2);
}
} // Input1Task
ZipSources.execute(new Input1Task()).on(input1);
}
}; // ZipDiff
代码示例来源:origin: net.java.trueupdate/trueupdate-core
@Override
public void output(final ZipSink sink) throws IOException {
class InputTask implements ZipInputTask<Void, IOException> {
public Void execute(final @WillNotClose ZipInput input) throws IOException {
class DeltaTask implements ZipInputTask<Void, IOException> {
public Void execute(final @WillNotClose ZipInput delta) throws IOException {
class OutputTask implements ZipOutputTask<Void, IOException> {
public Void execute(final @WillNotClose ZipOutput output) throws IOException {
new RawZipPatch() {
protected ZipInput input() { return input; }
protected ZipInput delta() { return delta; }
}.output(output);
return null;
}
} // OutputTask
return ZipSinks.execute(new OutputTask()).on(sink);
}
} // DeltaTask
return ZipSources.execute(new DeltaTask()).on(delta);
}
} // InputTask
ZipSources.execute(new InputTask()).on(input);
}
}; // ZipPatch
代码示例来源:origin: net.java.trueupdate/trueupdate-installer-core
public static void zip(final ZipSink sink,
final File fileOrDirectory,
final String entryName)
throws IOException {
class ZipTask implements ZipOutputTask<Void, IOException> {
@Override
public Void execute(final ZipOutput output) throws IOException {
class Zipper {
void zipDirectory(final File directory, final String name)
throws IOException {
final File[] memberFiles = directory.listFiles();
Arrays.sort(memberFiles); // courtesy
for (final File memberFile : memberFiles) {
final String memberName =
(name.isEmpty() ? name : name + '/')
+ memberFile.getName();
if (memberFile.isDirectory()) {
zipDirectory(memberFile, memberName);
} else {
zipFile(memberFile, memberName);
}
}
}
void zipFile(final File file, final String name)
throws IOException {
Copy.copy(source(file), sink(entry(name)));
}
内容来源于网络,如有侵权,请联系作者删除!