本文整理了Java中aQute.bnd.osgi.Jar.getResource()
方法的一些代码示例,展示了Jar.getResource()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jar.getResource()
方法的具体详情如下:
包路径:aQute.bnd.osgi.Jar
类名称:Jar
方法名:getResource
暂无
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib
private void copyInfoResource(Jar source, Jar dest, String type) {
if (source.getResources()
.containsKey(type)
&& !dest.getResources()
.containsKey(type))
dest.putResource(type, source.getResource(type));
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib
/**
* Locate a resource on the class path.
*
* @param path Path of the reosurce
* @return A resource or <code>null</code>
*/
public Resource findResource(String path) {
for (Jar entry : getClasspath()) {
Resource r = entry.getResource(path);
if (r != null)
return r;
}
return null;
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd
private static Document toDoc(InputStream in) throws Exception {
try (Jar jar = new Jar("feature", in)) {
Resource resource = jar.getResource("feature.xml");
if (resource == null) {
throw new IllegalArgumentException("JAR does not contain proper 'feature.xml");
}
DocumentBuilder db = XML.dbf.newDocumentBuilder();
Document doc = db.parse(resource.openInputStream());
return doc;
}
}
代码示例来源:origin: biz.aQute/bndlib
private void copyInfoResource(Jar source, Jar dest, String type) {
if (source.getResources().containsKey(type) && !dest.getResources().containsKey(type))
dest.putResource(type, source.getResource(type));
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.repository
private static Document toDoc(InputStream in) throws Exception {
try (Jar jar = new Jar("feature", in)) {
Resource resource = jar.getResource("feature.xml");
if (resource == null) {
throw new IllegalArgumentException("JAR does not contain proper 'feature.xml");
}
DocumentBuilder db = XML.dbf.newDocumentBuilder();
Document doc = db.parse(resource.openInputStream());
return doc;
}
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd
private void copyInfoResource(Jar source, Jar dest, String type) {
if (source.getResources()
.containsKey(type)
&& !dest.getResources()
.containsKey(type))
dest.putResource(type, source.getResource(type));
}
代码示例来源:origin: biz.aQute/bndlib
public Manifest getManifest() throws Exception {
check();
if (manifest == null) {
Resource manifestResource = getResource("META-INF/MANIFEST.MF");
if (manifestResource != null) {
InputStream in = manifestResource.openInputStream();
manifest = new Manifest(in);
in.close();
}
}
return manifest;
}
代码示例来源:origin: biz.aQute.bnd/bndlib
private void copyInfoResource(Jar source, Jar dest, String type) {
if (source.getResources().containsKey(type) && !dest.getResources().containsKey(type))
dest.putResource(type, source.getResource(type));
}
代码示例来源:origin: biz.aQute.bnd/bnd
public Manifest getManifest() throws Exception {
check();
if (manifest == null) {
Resource manifestResource = getResource(manifestName);
if (manifestResource != null) {
InputStream in = manifestResource.openInputStream();
manifest = new Manifest(in);
in.close();
}
}
return manifest;
}
代码示例来源:origin: biz.aQute.bnd/bndlib
public Manifest getManifest() throws Exception {
check();
if (manifest == null) {
Resource manifestResource = getResource(manifestName);
if (manifestResource != null) {
InputStream in = manifestResource.openInputStream();
manifest = new Manifest(in);
in.close();
}
}
return manifest;
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib
public Manifest getManifest() throws Exception {
check();
if (manifest == null) {
Resource manifestResource = getResource(manifestName);
if (manifestResource != null) {
try (InputStream in = manifestResource.openInputStream()) {
manifest = new Manifest(in);
}
}
}
return manifest;
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd
public Manifest getManifest() throws Exception {
check();
if (manifest == null) {
Resource manifestResource = getResource(manifestName);
if (manifestResource != null) {
try (InputStream in = manifestResource.openInputStream()) {
manifest = new Manifest(in);
}
}
}
return manifest;
}
代码示例来源:origin: biz.aQute/bndlib
public String _sha1(String args[]) throws Exception {
Macro.verifyCommand(args, _sha1Help, new Pattern[] {
null, null, Pattern.compile("base64|hex")
}, 2, 3);
Digester<SHA1> digester = SHA1.getDigester();
Resource r = dot.getResource(args[1]);
if (r == null)
throw new FileNotFoundException("From sha1, not found " + args[1]);
IO.copy(r.openInputStream(), digester);
return Base64.encodeBase64(digester.digest().digest());
}
代码示例来源:origin: biz.aQute.bnd/bndlib
public String _sha1(String args[]) throws Exception {
Macro.verifyCommand(args, _sha1Help, new Pattern[] {
null, null, Pattern.compile("base64|hex")
}, 2, 3);
Digester<SHA1> digester = SHA1.getDigester();
Resource r = dot.getResource(args[1]);
if (r == null)
throw new FileNotFoundException("From sha1, not found " + args[1]);
IO.copy(r.openInputStream(), digester);
return Base64.encodeBase64(digester.digest().digest());
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd
public String _sha1(String args[]) throws Exception {
Macro.verifyCommand(args, _sha1Help, new Pattern[] {
null, null, Pattern.compile("base64|hex")
}, 2, 3);
try (Digester<SHA1> digester = SHA1.getDigester()) {
Resource r = dot.getResource(args[1]);
if (r == null)
throw new FileNotFoundException("From sha1, not found " + args[1]);
IO.copy(r.openInputStream(), digester);
return Base64.encodeBase64(digester.digest()
.digest());
}
}
代码示例来源:origin: biz.aQute.bnd/bnd
public String _sha1(String args[]) throws Exception {
Macro.verifyCommand(args, _sha1Help, new Pattern[] {
null, null, Pattern.compile("base64|hex")
}, 2, 3);
Digester<SHA1> digester = SHA1.getDigester();
Resource r = dot.getResource(args[1]);
if (r == null)
throw new FileNotFoundException("From sha1, not found " + args[1]);
IO.copy(r.openInputStream(), digester);
return Base64.encodeBase64(digester.digest().digest());
}
代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib
public String _sha1(String args[]) throws Exception {
Macro.verifyCommand(args, _sha1Help, new Pattern[] {
null, null, Pattern.compile("base64|hex")
}, 2, 3);
try (Digester<SHA1> digester = SHA1.getDigester()) {
Resource r = dot.getResource(args[1]);
if (r == null)
throw new FileNotFoundException("From sha1, not found " + args[1]);
IO.copy(r.openInputStream(), digester);
return Base64.encodeBase64(digester.digest()
.digest());
}
}
代码示例来源:origin: biz.aQute/bndlib
public String _md5(String args[]) throws Exception {
Macro.verifyCommand(args, _md5Help, new Pattern[] {
null, null, Pattern.compile("base64|hex")
}, 2, 3);
Digester<MD5> digester = MD5.getDigester();
Resource r = dot.getResource(args[1]);
if (r == null)
throw new FileNotFoundException("From " + digester + ", not found " + args[1]);
IO.copy(r.openInputStream(), digester);
boolean hex = args.length > 2 && args[2].equals("hex");
if (hex)
return Hex.toHexString(digester.digest().digest());
return Base64.encodeBase64(digester.digest().digest());
}
代码示例来源:origin: biz.aQute.bnd/bnd
public String _md5(String args[]) throws Exception {
Macro.verifyCommand(args, _md5Help, new Pattern[] {
null, null, Pattern.compile("base64|hex")
}, 2, 3);
Digester<MD5> digester = MD5.getDigester();
Resource r = dot.getResource(args[1]);
if (r == null)
throw new FileNotFoundException("From " + digester + ", not found " + args[1]);
IO.copy(r.openInputStream(), digester);
boolean hex = args.length > 2 && args[2].equals("hex");
if (hex)
return Hex.toHexString(digester.digest().digest());
return Base64.encodeBase64(digester.digest().digest());
}
代码示例来源:origin: biz.aQute.bnd/bndlib
public String _md5(String args[]) throws Exception {
Macro.verifyCommand(args, _md5Help, new Pattern[] {
null, null, Pattern.compile("base64|hex")
}, 2, 3);
Digester<MD5> digester = MD5.getDigester();
Resource r = dot.getResource(args[1]);
if (r == null)
throw new FileNotFoundException("From " + digester + ", not found " + args[1]);
IO.copy(r.openInputStream(), digester);
boolean hex = args.length > 2 && args[2].equals("hex");
if (hex)
return Hex.toHexString(digester.digest().digest());
return Base64.encodeBase64(digester.digest().digest());
}
内容来源于网络,如有侵权,请联系作者删除!