java.util.jar.Manifest.read()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(139)

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

Manifest.read介绍

[英]Merges name/attribute pairs read from the input stream is into this manifest.
[中]将从输入流读取的名称/属性对合并到此清单中。

代码示例

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Creates a new {@code Manifest} instance using the attributes obtained
  3. * from the input stream.
  4. *
  5. * @param is
  6. * {@code InputStream} to parse for attributes.
  7. * @throws IOException
  8. * if an IO error occurs while creating this {@code Manifest}
  9. */
  10. public Manifest(InputStream is) throws IOException {
  11. read(is);
  12. }

代码示例来源:origin: robovm/robovm

  1. Manifest(InputStream is, boolean readChunks) throws IOException {
  2. if (readChunks) {
  3. chunks = new HashMap<String, Chunk>();
  4. }
  5. read(is);
  6. }

代码示例来源:origin: google/guava

  1. private static Manifest manifest(String content) throws IOException {
  2. InputStream in = new ByteArrayInputStream(content.getBytes(US_ASCII));
  3. Manifest manifest = new Manifest();
  4. manifest.read(in);
  5. return manifest;
  6. }

代码示例来源:origin: aol/micro-server

  1. public Map<String, String> getManifest(final InputStream input) {
  2. final Map<String, String> retMap = new HashMap<String, String>();
  3. try {
  4. Manifest manifest = new Manifest();
  5. manifest.read(input);
  6. final Attributes attributes = manifest.getMainAttributes();
  7. for (final Map.Entry attribute : attributes.entrySet()) {
  8. retMap.put(attribute.getKey().toString(), attribute.getValue().toString());
  9. }
  10. } catch (final Exception ex) {
  11. logger.error( "Failed to load manifest ", ex);
  12. }
  13. return retMap;
  14. }

代码示例来源:origin: aol/micro-server

  1. public Map<String, String> getManifest(final InputStream input) {
  2. final Map<String, String> retMap = new HashMap<String, String>();
  3. try {
  4. Manifest manifest = new Manifest();
  5. manifest.read(input);
  6. final Attributes attributes = manifest.getMainAttributes();
  7. for (final Map.Entry attribute : attributes.entrySet()) {
  8. retMap.put(attribute.getKey().toString(), attribute.getValue().toString());
  9. }
  10. } catch (final Exception ex) {
  11. logger.error("Failed to load manifest ", ex);
  12. }
  13. return retMap;
  14. }
  15. }

代码示例来源:origin: testcontainers/testcontainers-java

  1. try (InputStream is = manifestURL.openStream()) {
  2. Manifest manifest = new Manifest();
  3. manifest.read(is);

代码示例来源:origin: testcontainers/testcontainers-java

  1. /**
  2. * Check if Selenium Version detected is the correct one.
  3. * @param urlManifest : manifest file
  4. * @throws IOException
  5. */
  6. private void checkSeleniumVersionDetected(String urlManifest, String expectedVersion) throws IOException {
  7. Manifest manifest = new Manifest();
  8. manifest.read(this.getClass().getClassLoader().getResourceAsStream(urlManifest));
  9. String seleniumVersion = SeleniumUtils.getSeleniumVersionFromManifest(manifest);
  10. assertEquals("Check if Selenium Version detected is the correct one.", expectedVersion, seleniumVersion);
  11. }

代码示例来源:origin: geotools/geotools

  1. try {
  2. try (InputStream content = manifestLocation.openStream()) {
  3. manifest.read(content);
  4. manifest.read(new ByteArrayInputStream(generated.getBytes()));
  5. } catch (IOException e) {

代码示例来源:origin: geotools/geotools

  1. Manifest manifest = new Manifest();
  2. try (InputStream content = manifestLocation.openStream()) {
  3. manifest.read(content);

代码示例来源:origin: MobiVM/robovm

  1. /**
  2. * Creates a new {@code Manifest} instance using the attributes obtained
  3. * from the input stream.
  4. *
  5. * @param is
  6. * {@code InputStream} to parse for attributes.
  7. * @throws IOException
  8. * if an IO error occurs while creating this {@code Manifest}
  9. */
  10. public Manifest(InputStream is) throws IOException {
  11. read(is);
  12. }

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

  1. /**
  2. * Creates a new {@code Manifest} instance using the attributes obtained
  3. * from the input stream.
  4. *
  5. * @param is
  6. * {@code InputStream} to parse for attributes.
  7. * @throws IOException
  8. * if an IO error occurs while creating this {@code Manifest}
  9. */
  10. public Manifest(InputStream is) throws IOException {
  11. read(is);
  12. }

代码示例来源:origin: com.jtransc/jtransc-rt

  1. /**
  2. * Creates a new {@code Manifest} instance using the attributes obtained
  3. * from the input stream.
  4. *
  5. * @param is
  6. * {@code InputStream} to parse for attributes.
  7. * @throws IOException
  8. * if an IO error occurs while creating this {@code Manifest}
  9. */
  10. public Manifest(InputStream is) throws IOException {
  11. read(is);
  12. }

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

  1. Manifest(InputStream is, boolean readChunks) throws IOException {
  2. if (readChunks) {
  3. chunks = new HashMap<String, Chunk>();
  4. }
  5. read(is);
  6. }

代码示例来源:origin: com.gluonhq/robovm-rt

  1. Manifest(InputStream is, boolean readChunks) throws IOException {
  2. if (readChunks) {
  3. chunks = new HashMap<String, Chunk>();
  4. }
  5. read(is);
  6. }

代码示例来源:origin: de.smartics.deploy/deployment-metadata

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. protected Manifest readResource(final InputStream in) throws IOException
  6. {
  7. final Manifest manifest = new Manifest();
  8. manifest.read(in);
  9. return manifest;
  10. }

代码示例来源:origin: MobiVM/robovm

  1. Manifest(InputStream is, boolean readChunks) throws IOException {
  2. if (readChunks) {
  3. chunks = new HashMap<String, Chunk>();
  4. }
  5. read(is);
  6. }

代码示例来源:origin: stackoverflow.com

  1. public String getMavenVersion(ServletContext ctx) {
  2. String appServerHome = ctx.getRealPath("/");
  3. File manifestFile = new File(appServerHome, "META-INF/MANIFEST.MF");
  4. Manifest mf = new Manifest();
  5. mf.read(new FileInputStream(manifestFile));
  6. Attributes atts = mf.getMainAttributes();
  7. return atts.getValue("Implementation-Build");
  8. }

代码示例来源:origin: com.opentable.components/otj-server-core

  1. private void readManifest(final URL url) throws IOException {
  2. try (InputStream is = url.openStream()) {
  3. final Manifest mf = new Manifest();
  4. mf.read(is);
  5. final Attributes atts = mf.getMainAttributes();
  6. LOG.debug("Starting up: {} version {} - built from commit {}",
  7. atts.getValue(Attributes.Name.IMPLEMENTATION_TITLE),
  8. atts.getValue(Attributes.Name.IMPLEMENTATION_VERSION),
  9. atts.getValue(COMMIT)
  10. );
  11. }
  12. }

代码示例来源:origin: org.patterntesting/patterntesting-rt

  1. private static Manifest getManifest(final URI uri) throws IOException {
  2. String content = IOUtils.toString(uri, StandardCharsets.UTF_8);
  3. InputStream istream = new ByteArrayInputStream(content.getBytes("UTF8"));
  4. try {
  5. Manifest manifest = new Manifest(istream);
  6. manifest.read(istream);
  7. manifest.getMainAttributes().putValue(MANIFEST_URI, uri.toString());
  8. return manifest;
  9. } finally {
  10. istream.close();
  11. }
  12. }

代码示例来源:origin: org.glassfish.common/common-util

  1. public AdminCommandResponse(InputStream inStream) throws IOException {
  2. Manifest m = new Manifest(inStream);
  3. m.read(inStream);
  4. allRaw = ManifestUtils.normalize(m);
  5. mainRaw = ManifestUtils.getMain(allRaw);
  6. makeMain();
  7. }

相关文章