/** * Create an instance of this class from a {@link Manifest} object. * * @param f The manifest to read from. */ public ManifestFile(Manifest f) { load(f); }
/** * Create an instance of this class from a {@link Manifest} object. * * @param f The manifest to read from. */ public ManifestFile(Manifest f) { load(f); }
/** * Create an instance of this class from a {@link Manifest} object. * * @param f The manifest to read from. */ public ManifestFile(Manifest f) { load(f); }
/** * Create an instance of this class loaded from the contents of an input stream. * * <p> * Note that the input must end in a newline to pick up the last line! * * @param is The manifest file contents. * @throws IOException If a problem occurred while trying to read the manifest file. */ public ManifestFile(InputStream is) throws IOException { load(new Manifest(is)); }
/** * Create an instance of this class loaded from the contents of an input stream. * * <p> * Note that the input must end in a newline to pick up the last line! * * @param is The manifest file contents. * @throws IOException If a problem occurred while trying to read the manifest file. */ public ManifestFile(InputStream is) throws IOException { load(new Manifest(is)); }
/** * Create an instance of this class loaded from the contents of an input stream. * * <p> * Note that the input must end in a newline to pick up the last line! * * @param is The manifest file contents. * @throws IOException If a problem occurred while trying to read the manifest file. */ public ManifestFile(InputStream is) throws IOException { load(new Manifest(is)); }
/** * Create an instance of this class loaded from the contents of a reader. * * <p> * Note that the input must end in a newline to pick up the last line! * * @param r The manifest file contents. * @throws IOException If a problem occurred while trying to read the manifest file. */ public ManifestFile(Reader r) throws IOException { load(new Manifest(IOUtils.toInputStream(r))); }
/** * Create an instance of this class loaded from the contents of a reader. * * <p> * Note that the input must end in a newline to pick up the last line! * * @param r The manifest file contents. * @throws IOException If a problem occurred while trying to read the manifest file. */ public ManifestFile(Reader r) throws IOException { load(new Manifest(IOUtils.toInputStream(r))); }
/** * Create an instance of this class loaded from the contents of a reader. * * <p> * Note that the input must end in a newline to pick up the last line! * * @param r The manifest file contents. * @throws IOException If a problem occurred while trying to read the manifest file. */ public ManifestFile(Reader r) throws IOException { load(new Manifest(IOUtils.toInputStream(r))); }
/** * Finds and loads the manifest file of the jar file that the specified class is contained within. * * @param c The class to get the manifest file of. * @throws IOException If a problem occurred while trying to read the manifest file. */ public ManifestFile(Class<?> c) throws IOException { String className = c.getSimpleName() + ".class"; String classPath = c.getResource(className).toString(); if (! classPath.startsWith("jar")) { return; } String manifestPath = classPath.substring(0, classPath.lastIndexOf("!") + 1) + "/META-INF/MANIFEST.MF"; try { Manifest mf = new Manifest(new URL(manifestPath).openStream()); load(mf); } catch (MalformedURLException e) { throw new IOException(e); } catch (IOException e) { e.printStackTrace(); } }
/** * Finds and loads the manifest file of the jar file that the specified class is contained within. * * @param c The class to get the manifest file of. * @throws IOException If a problem occurred while trying to read the manifest file. */ public ManifestFile(Class<?> c) throws IOException { String className = c.getSimpleName() + ".class"; String classPath = c.getResource(className).toString(); if (! classPath.startsWith("jar")) { return; } String manifestPath = classPath.substring(0, classPath.lastIndexOf("!") + 1) + "/META-INF/MANIFEST.MF"; try { Manifest mf = new Manifest(new URL(manifestPath).openStream()); load(mf); } catch (MalformedURLException e) { throw new IOException(e); } catch (IOException e) { e.printStackTrace(); } }
/** * Finds and loads the manifest file of the jar file that the specified class is contained within. * * @param c The class to get the manifest file of. * @throws IOException If a problem occurred while trying to read the manifest file. */ public ManifestFile(Class<?> c) throws IOException { String className = c.getSimpleName() + ".class"; String classPath = c.getResource(className).toString(); if (! classPath.startsWith("jar")) { return; } String manifestPath = classPath.substring(0, classPath.lastIndexOf("!") + 1) + "/META-INF/MANIFEST.MF"; try { Manifest mf = new Manifest(new URL(manifestPath).openStream()); load(mf); } catch (MalformedURLException e) { throw new IOException(e); } catch (IOException e) { e.printStackTrace(); } }
/** * Create an instance of this class from a manifest file on the file system. * * @param f The manifest file. * @throws IOException If a problem occurred while trying to read the manifest file. */ public ManifestFile(File f) throws IOException { Manifest mf = new Manifest(); try (FileInputStream fis = new FileInputStream(f)) { mf.read(fis); load(mf); } catch (IOException e) { throw new IOException("Problem detected in MANIFEST.MF. Contents below:\n" + read(f), e); } }
/** * Create an instance of this class from a manifest file on the file system. * * @param f The manifest file. * @throws IOException If a problem occurred while trying to read the manifest file. */ public ManifestFile(File f) throws IOException { Manifest mf = new Manifest(); try (FileInputStream fis = new FileInputStream(f)) { mf.read(fis); load(mf); } catch (IOException e) { throw new IOException("Problem detected in MANIFEST.MF. Contents below:\n" + read(f), e); } }
/** * Create an instance of this class from a manifest file on the file system. * * @param f The manifest file. * @throws IOException If a problem occurred while trying to read the manifest file. */ public ManifestFile(File f) throws IOException { Manifest mf = new Manifest(); try (FileInputStream fis = new FileInputStream(f)) { mf.read(fis); load(mf); } catch (IOException e) { throw new IOException("Problem detected in MANIFEST.MF. Contents below:\n" + read(f), e); } }