private void copyInfoResource(Jar source, Jar dest, String type) { if (source.getResources() .containsKey(type) && !dest.getResources() .containsKey(type)) dest.putResource(type, source.getResource(type)); }
/** * 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; }
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; } }
private void copyInfoResource(Jar source, Jar dest, String type) { if (source.getResources().containsKey(type) && !dest.getResources().containsKey(type)) dest.putResource(type, source.getResource(type)); }
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; } }
private void copyInfoResource(Jar source, Jar dest, String type) { if (source.getResources() .containsKey(type) && !dest.getResources() .containsKey(type)) dest.putResource(type, source.getResource(type)); }
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; }
private void copyInfoResource(Jar source, Jar dest, String type) { if (source.getResources().containsKey(type) && !dest.getResources().containsKey(type)) dest.putResource(type, source.getResource(type)); }
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; }
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; }
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; }
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; }
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()); }
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()); }
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()); } }
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()); }
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()); } }
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()); }
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()); }
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()); }