本文整理了Java中aQute.lib.osgi.Jar.createDirectories()
方法的一些代码示例,展示了Jar.createDirectories()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jar.createDirectories()
方法的具体详情如下:
包路径:aQute.lib.osgi.Jar
类名称:Jar
方法名:createDirectories
暂无
代码示例来源:origin: biz.aQute/aQute.bnd
void createDirectories(Set<String> directories, ZipOutputStream zip,
String name) throws IOException {
int index = name.lastIndexOf('/');
if (index > 0) {
String path = name.substring(0, index);
if (directories.contains(path))
return;
createDirectories(directories, zip, path);
ZipEntry ze = new ZipEntry(path + '/');
zip.putNextEntry(ze);
zip.closeEntry();
directories.add(path);
}
}
代码示例来源:origin: biz.aQute/bnd
void createDirectories(Set<String> directories, ZipOutputStream zip, String name)
throws IOException {
int index = name.lastIndexOf('/');
if (index > 0) {
String path = name.substring(0, index);
if (directories.contains(path))
return;
createDirectories(directories, zip, path);
ZipEntry ze = new ZipEntry(path + '/');
zip.putNextEntry(ze);
zip.closeEntry();
directories.add(path);
}
}
代码示例来源:origin: biz.aQute/bnd
private void writeResource(ZipOutputStream jout, Set<String> directories, String path,
Resource resource) throws Exception {
if (resource == null)
return;
createDirectories(directories, jout, path);
ZipEntry ze = new ZipEntry(path);
ze.setMethod(ZipEntry.DEFLATED);
long lastModified = resource.lastModified();
if (lastModified == 0L) {
lastModified = System.currentTimeMillis();
}
ze.setTime(lastModified);
if (resource.getExtra() != null)
ze.setExtra(resource.getExtra().getBytes());
jout.putNextEntry(ze);
resource.write(jout);
jout.closeEntry();
}
代码示例来源:origin: biz.aQute/aQute.bnd
private void writeResource(ZipOutputStream jout, Set<String> directories,
String path, Resource resource) throws IOException {
if (resource == null)
return;
createDirectories(directories, jout, path);
ZipEntry ze = new ZipEntry(path);
ze.setMethod(ZipEntry.DEFLATED);
long lastModified = resource.lastModified();
if (lastModified == 0L) {
lastModified = System.currentTimeMillis();
}
ze.setTime(lastModified);
if (resource.getExtra() != null)
ze.setExtra(resource.getExtra().getBytes());
jout.putNextEntry(ze);
try {
resource.write(jout);
} catch (Exception e) {
throw new IllegalArgumentException("Cannot write resource: " + path
+ " " + resource + " exception: " + e);
}
jout.closeEntry();
}
内容来源于网络,如有侵权,请联系作者删除!