本文整理了Java中aQute.bnd.osgi.Jar.writeManifest()
方法的一些代码示例,展示了Jar.writeManifest()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jar.writeManifest()
方法的具体详情如下:
包路径:aQute.bnd.osgi.Jar
类名称:Jar
方法名:writeManifest
[英]Cleanup the manifest for writing. Cleaning up consists of adding a space after any \n to prevent the manifest to see this newline as a delimiter.
[中]清理清单以进行写入。清理包括在任何空格后添加空格,\n以防止清单将此换行符视为分隔符。
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib
@Override
public void write(OutputStream out) throws Exception {
writeManifest(out);
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd
@Override
public void write(OutputStream out) throws Exception {
writeManifest(out);
}
代码示例来源:origin: biz.aQute/bndlib
private void doManifest(Set<String> done, ZipOutputStream jout) throws Exception {
check();
if (nomanifest)
return;
JarEntry ze = new JarEntry("META-INF/MANIFEST.MF");
jout.putNextEntry(ze);
writeManifest(jout);
jout.closeEntry();
done.add(ze.getName());
}
代码示例来源:origin: biz.aQute.bnd/bndlib
private void doManifest(Set<String> done, ZipOutputStream jout) throws Exception {
check();
if (nomanifest)
return;
JarEntry ze = new JarEntry(manifestName);
ZipUtil.setModifiedTime(ze,lastModified);
jout.putNextEntry(ze);
writeManifest(jout);
jout.closeEntry();
done.add(ze.getName());
}
代码示例来源:origin: biz.aQute.bnd/bnd
private void doManifest(Set<String> done, ZipOutputStream jout) throws Exception {
check();
if (nomanifest)
return;
JarEntry ze = new JarEntry(manifestName);
ZipUtil.setModifiedTime(ze,lastModified);
jout.putNextEntry(ze);
writeManifest(jout);
jout.closeEntry();
done.add(ze.getName());
}
代码示例来源:origin: biz.aQute.bnd/bnd
/**
* Cleanup the manifest for writing. Cleaning up consists of adding a space
* after any \n to prevent the manifest to see this newline as a delimiter.
*
* @param out
* Output
* @throws IOException
*/
public void writeManifest(OutputStream out) throws Exception {
check();
writeManifest(getManifest(), out);
}
代码示例来源:origin: biz.aQute/bndlib
/**
* Cleanup the manifest for writing. Cleaning up consists of adding a space
* after any \n to prevent the manifest to see this newline as a delimiter.
*
* @param out
* Output
* @throws IOException
*/
public void writeManifest(OutputStream out) throws Exception {
check();
writeManifest(getManifest(), out);
}
代码示例来源:origin: biz.aQute.bnd/bndlib
/**
* Cleanup the manifest for writing. Cleaning up consists of adding a space
* after any \n to prevent the manifest to see this newline as a delimiter.
*
* @param out
* Output
* @throws IOException
*/
public void writeManifest(OutputStream out) throws Exception {
check();
writeManifest(getManifest(), out);
}
代码示例来源:origin: biz.aQute/bndlib
/**
* Get the manifest and write it out separately if -savemanifest is set
*
* @param dot
*/
private void doSaveManifest(Jar dot) throws Exception {
String output = getProperty(SAVEMANIFEST);
if (output == null)
return;
File f = getFile(output);
if (f.isDirectory()) {
f = new File(f, "MANIFEST.MF");
}
f.delete();
File fp = f.getParentFile();
if (!fp.exists() && !fp.mkdirs()) {
throw new IOException("Could not create directory " + fp);
}
OutputStream out = new FileOutputStream(f);
try {
Jar.writeManifest(dot.getManifest(), out);
}
finally {
out.close();
}
changedFile(f);
}
代码示例来源:origin: biz.aQute.bnd/bnd
/**
* Get the manifest and write it out separately if -savemanifest is set
*
* @param dot
*/
private void doSaveManifest(Jar dot) throws Exception {
String output = getProperty(SAVEMANIFEST);
if (output == null)
return;
File f = getFile(output);
if (f.isDirectory()) {
f = new File(f, "MANIFEST.MF");
}
f.delete();
File fp = f.getParentFile();
if (!fp.exists() && !fp.mkdirs()) {
throw new IOException("Could not create directory " + fp);
}
OutputStream out = new FileOutputStream(f);
try {
Jar.writeManifest(dot.getManifest(), out);
}
finally {
out.close();
}
changedFile(f);
}
代码示例来源:origin: biz.aQute.bnd/bndlib
/**
* Get the manifest and write it out separately if -savemanifest is set
*
* @param dot
*/
private void doSaveManifest(Jar dot) throws Exception {
String output = getProperty(SAVEMANIFEST);
if (output == null)
return;
File f = getFile(output);
if (f.isDirectory()) {
f = new File(f, "MANIFEST.MF");
}
f.delete();
File fp = f.getParentFile();
if (!fp.exists() && !fp.mkdirs()) {
throw new IOException("Could not create directory " + fp);
}
OutputStream out = new FileOutputStream(f);
try {
Jar.writeManifest(dot.getManifest(), out);
}
finally {
out.close();
}
changedFile(f);
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd
/**
* Cleanup the manifest for writing. Cleaning up consists of adding a space
* after any \n to prevent the manifest to see this newline as a delimiter.
*
* @param out Output
* @throws IOException
*/
public void writeManifest(OutputStream out) throws Exception {
check();
stripSignatures();
writeManifest(getManifest(), out);
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib
/**
* Cleanup the manifest for writing. Cleaning up consists of adding a space
* after any \n to prevent the manifest to see this newline as a delimiter.
*
* @param out Output
* @throws IOException
*/
public void writeManifest(OutputStream out) throws Exception {
check();
stripSignatures();
writeManifest(getManifest(), out);
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib
IO.mkdirs(file.getParentFile());
try (OutputStream fout = IO.outputStream(file)) {
writeManifest(fout);
done.add(manifestName);
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd
public byte[] getTimelessDigest() throws Exception {
check();
MessageDigest md = MessageDigest.getInstance("SHA1");
OutputStream dout = new DigestOutputStream(IO.nullStream, md);
// dout = System.out;
Manifest m = getManifest();
if (m != null) {
Manifest m2 = new Manifest(m);
Attributes main = m2.getMainAttributes();
String lastmodified = (String) main.remove(new Attributes.Name(Constants.BND_LASTMODIFIED));
String version = main.getValue(new Attributes.Name(Constants.BUNDLE_VERSION));
if (version != null && Verifier.isVersion(version)) {
Version v = new Version(version);
main.putValue(Constants.BUNDLE_VERSION, v.toStringWithoutQualifier());
}
writeManifest(m2, dout);
for (Map.Entry<String, Resource> entry : getResources().entrySet()) {
String path = entry.getKey();
if (path.equals(manifestName))
continue;
Resource resource = entry.getValue();
dout.write(path.getBytes(UTF_8));
resource.write(dout);
}
}
return md.digest();
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib
public byte[] getTimelessDigest() throws Exception {
check();
MessageDigest md = MessageDigest.getInstance("SHA1");
OutputStream dout = new DigestOutputStream(IO.nullStream, md);
// dout = System.out;
Manifest m = getManifest();
if (m != null) {
Manifest m2 = new Manifest(m);
Attributes main = m2.getMainAttributes();
String lastmodified = (String) main.remove(new Attributes.Name(Constants.BND_LASTMODIFIED));
String version = main.getValue(new Attributes.Name(Constants.BUNDLE_VERSION));
if (version != null && Verifier.isVersion(version)) {
Version v = new Version(version);
main.putValue(Constants.BUNDLE_VERSION, v.toStringWithoutQualifier());
}
writeManifest(m2, dout);
for (Map.Entry<String, Resource> entry : getResources().entrySet()) {
String path = entry.getKey();
if (path.equals(manifestName))
continue;
Resource resource = entry.getValue();
dout.write(path.getBytes(UTF_8));
resource.write(dout);
}
}
return md.digest();
}
代码示例来源:origin: biz.aQute.bnd/bndlib
main.putValue( Constants.BUNDLE_VERSION, v.getWithoutQualifier().toString());
writeManifest(m2, dout);
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib
/**
* Get the manifest and write it out separately if -savemanifest is set
*
* @param dot
*/
private void doSaveManifest(Jar dot) throws Exception {
String output = getProperty(SAVEMANIFEST);
if (output == null)
return;
File f = getFile(output);
if (f.isDirectory()) {
f = new File(f, "MANIFEST.MF");
}
if (!f.exists() || f.lastModified() < dot.lastModified()) {
IO.delete(f);
File fp = f.getParentFile();
IO.mkdirs(fp);
try (OutputStream out = IO.outputStream(f)) {
Jar.writeManifest(dot.getManifest(), out);
}
changedFile(f);
}
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd
/**
* Get the manifest and write it out separately if -savemanifest is set
*
* @param dot
*/
private void doSaveManifest(Jar dot) throws Exception {
String output = getProperty(SAVEMANIFEST);
if (output == null)
return;
File f = getFile(output);
if (f.isDirectory()) {
f = new File(f, "MANIFEST.MF");
}
if (!f.exists() || f.lastModified() < dot.lastModified()) {
IO.delete(f);
File fp = f.getParentFile();
IO.mkdirs(fp);
try (OutputStream out = IO.outputStream(f)) {
Jar.writeManifest(dot.getManifest(), out);
}
changedFile(f);
}
}
代码示例来源:origin: diffplug/goomph
private static String getManifestContent(Jar jarTask, BndManifestExtension extension) throws Throwable {
// if we don't want to merge, then delete the existing manifest so that bnd doesn't merge with it
if (!extension.mergeWithExisting) {
Files.deleteIfExists(outputManifest(jarTask));
}
// take the bnd action
return BndManifestPlugin.takeBndAction(jarTask.getProject(), jarTask, jar -> {
return StringPrinter.buildString(printer -> {
try (OutputStream output = printer.toOutputStream(StandardCharsets.UTF_8)) {
aQute.bnd.osgi.Jar.writeManifest(jar.getManifest(), printer.toOutputStream(StandardCharsets.UTF_8));
} catch (Exception e) {
throw Errors.asRuntime(e);
}
});
});
}
内容来源于网络,如有侵权,请联系作者删除!