View Javadoc
1   /*
2    * SPDX-FileCopyrightText: Copyright (c) 2012-2025 Yegor Bugayenko
3    * SPDX-License-Identifier: MIT
4    */
5   package com.jcabi.manifests;
6   
7   import java.io.IOException;
8   import java.io.InputStream;
9   import java.net.URL;
10  import java.util.ArrayList;
11  import java.util.Collection;
12  import java.util.Enumeration;
13  
14  /**
15   * Manifests in classpath.
16   *
17   * @since 1.0
18   */
19  public final class ClasspathMfs implements Mfs {
20  
21      @Override
22      public Collection<InputStream> fetch() throws IOException {
23          final Enumeration<URL> resources = Thread.currentThread()
24              .getContextClassLoader()
25              .getResources("META-INF/MANIFEST.MF");
26          final Collection<InputStream> streams = new ArrayList<>(1);
27          while (resources.hasMoreElements()) {
28              streams.add(resources.nextElement().openStream());
29          }
30          return streams;
31      }
32  
33  }