Java BufferedInputStream Create getInputStreamFromString(String _string)

Here you can find the source of getInputStreamFromString(String _string)

Description

Get an InputStream from a String instance.

License

Mozilla Public License

Parameter

Parameter Description
_string A String.

Return

An InputStream.

Declaration

public static InputStream getInputStreamFromString(String _string) 

Method Source Code

//package com.java2s;
//License from project: Mozilla Public License 

import java.io.ByteArrayInputStream;

import java.io.InputStream;

public class Main {
    /**// w  ww  .j a va 2s.  co  m
     * Get an {@link InputStream} from a {@link String} instance.
     * @param _string A String.
     * @return An InputStream.
     */
    public static InputStream getInputStreamFromString(String _string) {
        try {
            return (new ByteArrayInputStream(_string.getBytes("UTF-8")));
        } catch (java.io.UnsupportedEncodingException e) {
            return null;
        }
    }
}

Related

  1. getInputStream(String resource)
  2. getInputStream(String string)
  3. getInputstreamForZipEntry(ZipFile zipFile, String uri)
  4. getInputStreamFromEncodedStr(String encodedDetails)
  5. getInputStreamFromString(String _string)
  6. getInputStreamFromString(String input)
  7. getInputStreamFromString(String s)
  8. getStream(byte[] bytes)
  9. getStream(final File file)