aQute.bnd.osgi.Jar.getResource()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(246)

本文整理了Java中aQute.bnd.osgi.Jar.getResource()方法的一些代码示例,展示了Jar.getResource()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jar.getResource()方法的具体详情如下:
包路径:aQute.bnd.osgi.Jar
类名称:Jar
方法名:getResource

Jar.getResource介绍

暂无

代码示例

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

  1. private void copyInfoResource(Jar source, Jar dest, String type) {
  2. if (source.getResources()
  3. .containsKey(type)
  4. && !dest.getResources()
  5. .containsKey(type))
  6. dest.putResource(type, source.getResource(type));
  7. }

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

  1. /**
  2. * Locate a resource on the class path.
  3. *
  4. * @param path Path of the reosurce
  5. * @return A resource or <code>null</code>
  6. */
  7. public Resource findResource(String path) {
  8. for (Jar entry : getClasspath()) {
  9. Resource r = entry.getResource(path);
  10. if (r != null)
  11. return r;
  12. }
  13. return null;
  14. }

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

  1. private static Document toDoc(InputStream in) throws Exception {
  2. try (Jar jar = new Jar("feature", in)) {
  3. Resource resource = jar.getResource("feature.xml");
  4. if (resource == null) {
  5. throw new IllegalArgumentException("JAR does not contain proper 'feature.xml");
  6. }
  7. DocumentBuilder db = XML.dbf.newDocumentBuilder();
  8. Document doc = db.parse(resource.openInputStream());
  9. return doc;
  10. }
  11. }

代码示例来源:origin: biz.aQute/bndlib

  1. private void copyInfoResource(Jar source, Jar dest, String type) {
  2. if (source.getResources().containsKey(type) && !dest.getResources().containsKey(type))
  3. dest.putResource(type, source.getResource(type));
  4. }

代码示例来源:origin: biz.aQute.bnd/biz.aQute.repository

  1. private static Document toDoc(InputStream in) throws Exception {
  2. try (Jar jar = new Jar("feature", in)) {
  3. Resource resource = jar.getResource("feature.xml");
  4. if (resource == null) {
  5. throw new IllegalArgumentException("JAR does not contain proper 'feature.xml");
  6. }
  7. DocumentBuilder db = XML.dbf.newDocumentBuilder();
  8. Document doc = db.parse(resource.openInputStream());
  9. return doc;
  10. }
  11. }

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

  1. private void copyInfoResource(Jar source, Jar dest, String type) {
  2. if (source.getResources()
  3. .containsKey(type)
  4. && !dest.getResources()
  5. .containsKey(type))
  6. dest.putResource(type, source.getResource(type));
  7. }

代码示例来源:origin: biz.aQute/bndlib

  1. public Manifest getManifest() throws Exception {
  2. check();
  3. if (manifest == null) {
  4. Resource manifestResource = getResource("META-INF/MANIFEST.MF");
  5. if (manifestResource != null) {
  6. InputStream in = manifestResource.openInputStream();
  7. manifest = new Manifest(in);
  8. in.close();
  9. }
  10. }
  11. return manifest;
  12. }

代码示例来源:origin: biz.aQute.bnd/bndlib

  1. private void copyInfoResource(Jar source, Jar dest, String type) {
  2. if (source.getResources().containsKey(type) && !dest.getResources().containsKey(type))
  3. dest.putResource(type, source.getResource(type));
  4. }

代码示例来源:origin: biz.aQute.bnd/bnd

  1. public Manifest getManifest() throws Exception {
  2. check();
  3. if (manifest == null) {
  4. Resource manifestResource = getResource(manifestName);
  5. if (manifestResource != null) {
  6. InputStream in = manifestResource.openInputStream();
  7. manifest = new Manifest(in);
  8. in.close();
  9. }
  10. }
  11. return manifest;
  12. }

代码示例来源:origin: biz.aQute.bnd/bndlib

  1. public Manifest getManifest() throws Exception {
  2. check();
  3. if (manifest == null) {
  4. Resource manifestResource = getResource(manifestName);
  5. if (manifestResource != null) {
  6. InputStream in = manifestResource.openInputStream();
  7. manifest = new Manifest(in);
  8. in.close();
  9. }
  10. }
  11. return manifest;
  12. }

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

  1. public Manifest getManifest() throws Exception {
  2. check();
  3. if (manifest == null) {
  4. Resource manifestResource = getResource(manifestName);
  5. if (manifestResource != null) {
  6. try (InputStream in = manifestResource.openInputStream()) {
  7. manifest = new Manifest(in);
  8. }
  9. }
  10. }
  11. return manifest;
  12. }

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

  1. public Manifest getManifest() throws Exception {
  2. check();
  3. if (manifest == null) {
  4. Resource manifestResource = getResource(manifestName);
  5. if (manifestResource != null) {
  6. try (InputStream in = manifestResource.openInputStream()) {
  7. manifest = new Manifest(in);
  8. }
  9. }
  10. }
  11. return manifest;
  12. }

代码示例来源:origin: biz.aQute/bndlib

  1. public String _sha1(String args[]) throws Exception {
  2. Macro.verifyCommand(args, _sha1Help, new Pattern[] {
  3. null, null, Pattern.compile("base64|hex")
  4. }, 2, 3);
  5. Digester<SHA1> digester = SHA1.getDigester();
  6. Resource r = dot.getResource(args[1]);
  7. if (r == null)
  8. throw new FileNotFoundException("From sha1, not found " + args[1]);
  9. IO.copy(r.openInputStream(), digester);
  10. return Base64.encodeBase64(digester.digest().digest());
  11. }

代码示例来源:origin: biz.aQute.bnd/bndlib

  1. public String _sha1(String args[]) throws Exception {
  2. Macro.verifyCommand(args, _sha1Help, new Pattern[] {
  3. null, null, Pattern.compile("base64|hex")
  4. }, 2, 3);
  5. Digester<SHA1> digester = SHA1.getDigester();
  6. Resource r = dot.getResource(args[1]);
  7. if (r == null)
  8. throw new FileNotFoundException("From sha1, not found " + args[1]);
  9. IO.copy(r.openInputStream(), digester);
  10. return Base64.encodeBase64(digester.digest().digest());
  11. }

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bnd

  1. public String _sha1(String args[]) throws Exception {
  2. Macro.verifyCommand(args, _sha1Help, new Pattern[] {
  3. null, null, Pattern.compile("base64|hex")
  4. }, 2, 3);
  5. try (Digester<SHA1> digester = SHA1.getDigester()) {
  6. Resource r = dot.getResource(args[1]);
  7. if (r == null)
  8. throw new FileNotFoundException("From sha1, not found " + args[1]);
  9. IO.copy(r.openInputStream(), digester);
  10. return Base64.encodeBase64(digester.digest()
  11. .digest());
  12. }
  13. }

代码示例来源:origin: biz.aQute.bnd/bnd

  1. public String _sha1(String args[]) throws Exception {
  2. Macro.verifyCommand(args, _sha1Help, new Pattern[] {
  3. null, null, Pattern.compile("base64|hex")
  4. }, 2, 3);
  5. Digester<SHA1> digester = SHA1.getDigester();
  6. Resource r = dot.getResource(args[1]);
  7. if (r == null)
  8. throw new FileNotFoundException("From sha1, not found " + args[1]);
  9. IO.copy(r.openInputStream(), digester);
  10. return Base64.encodeBase64(digester.digest().digest());
  11. }

代码示例来源:origin: biz.aQute.bnd/biz.aQute.bndlib

  1. public String _sha1(String args[]) throws Exception {
  2. Macro.verifyCommand(args, _sha1Help, new Pattern[] {
  3. null, null, Pattern.compile("base64|hex")
  4. }, 2, 3);
  5. try (Digester<SHA1> digester = SHA1.getDigester()) {
  6. Resource r = dot.getResource(args[1]);
  7. if (r == null)
  8. throw new FileNotFoundException("From sha1, not found " + args[1]);
  9. IO.copy(r.openInputStream(), digester);
  10. return Base64.encodeBase64(digester.digest()
  11. .digest());
  12. }
  13. }

代码示例来源:origin: biz.aQute/bndlib

  1. public String _md5(String args[]) throws Exception {
  2. Macro.verifyCommand(args, _md5Help, new Pattern[] {
  3. null, null, Pattern.compile("base64|hex")
  4. }, 2, 3);
  5. Digester<MD5> digester = MD5.getDigester();
  6. Resource r = dot.getResource(args[1]);
  7. if (r == null)
  8. throw new FileNotFoundException("From " + digester + ", not found " + args[1]);
  9. IO.copy(r.openInputStream(), digester);
  10. boolean hex = args.length > 2 && args[2].equals("hex");
  11. if (hex)
  12. return Hex.toHexString(digester.digest().digest());
  13. return Base64.encodeBase64(digester.digest().digest());
  14. }

代码示例来源:origin: biz.aQute.bnd/bnd

  1. public String _md5(String args[]) throws Exception {
  2. Macro.verifyCommand(args, _md5Help, new Pattern[] {
  3. null, null, Pattern.compile("base64|hex")
  4. }, 2, 3);
  5. Digester<MD5> digester = MD5.getDigester();
  6. Resource r = dot.getResource(args[1]);
  7. if (r == null)
  8. throw new FileNotFoundException("From " + digester + ", not found " + args[1]);
  9. IO.copy(r.openInputStream(), digester);
  10. boolean hex = args.length > 2 && args[2].equals("hex");
  11. if (hex)
  12. return Hex.toHexString(digester.digest().digest());
  13. return Base64.encodeBase64(digester.digest().digest());
  14. }

代码示例来源:origin: biz.aQute.bnd/bndlib

  1. public String _md5(String args[]) throws Exception {
  2. Macro.verifyCommand(args, _md5Help, new Pattern[] {
  3. null, null, Pattern.compile("base64|hex")
  4. }, 2, 3);
  5. Digester<MD5> digester = MD5.getDigester();
  6. Resource r = dot.getResource(args[1]);
  7. if (r == null)
  8. throw new FileNotFoundException("From " + digester + ", not found " + args[1]);
  9. IO.copy(r.openInputStream(), digester);
  10. boolean hex = args.length > 2 && args[2].equals("hex");
  11. if (hex)
  12. return Hex.toHexString(digester.digest().digest());
  13. return Base64.encodeBase64(digester.digest().digest());
  14. }

相关文章