Java BufferedInputStream Create getInputStreamFromString(String _string)

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

Description

Get an input stream from a source String.

License

Mozilla Public License

Parameter

Parameter Description
_string The resource string

Exception

Parameter Description
IOException an exception

Return

an representing the resource

Declaration


public static InputStream getInputStreamFromString(String _string) throws IOException 

Method Source Code

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

import java.io.ByteArrayInputStream;

import java.io.InputStream;

import java.io.IOException;

public class Main {
    /**/*from  ww  w.j  ava 2  s . c o  m*/
     * Get an input stream from a source String.
     * @param _string  The resource string
     * @return an {@link InputStream} representing the resource
     * @throws IOException 
     */
    // Get an InputStream from a String.
    public static InputStream getInputStreamFromString(String _string) throws IOException {
        return (new ByteArrayInputStream(_string.getBytes("UTF-8")));
    }
}

Related

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