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.ByteArrayInputStream;
8   import java.io.InputStream;
9   import java.nio.charset.StandardCharsets;
10  import java.util.Collection;
11  import java.util.Collections;
12  
13  /**
14   * Manifests in a UTF-8 string.
15   *
16   * <p>The class is immutable and thread-safe.
17   *
18   * @since 1.3
19   */
20  public final class StringMfs implements Mfs {
21  
22      /**
23       * The string.
24       */
25      private final transient String source;
26  
27      /**
28       * Ctor.
29       * @param src The source
30       */
31      public StringMfs(final String src) {
32          this.source = src;
33      }
34  
35      @Override
36      public Collection<InputStream> fetch() {
37          return Collections.singleton(
38              new ByteArrayInputStream(this.source.getBytes(StandardCharsets.UTF_8))
39          );
40      }
41  
42  }