Java InputStream Read by Charset toInputStream(String input, Charset cs)

Here you can find the source of toInputStream(String input, Charset cs)

Description

to Input Stream

License

Open Source License

Declaration

public static InputStream toInputStream(String input, Charset cs) 

Method Source Code

//package com.java2s;
import java.io.ByteArrayInputStream;

import java.io.InputStream;

import java.nio.charset.Charset;

public class Main {
    public static InputStream toInputStream(String input) {
        return toInputStream(input, Charset.defaultCharset());
    }/* w  w  w .j  a v a2s .  c o  m*/

    public static InputStream toInputStream(String input, Charset cs) {
        return new ByteArrayInputStream(input.getBytes(cs));
    }
}

Related

  1. streamToString(final InputStream is, final Charset charset)
  2. streamToString(InputStream inputStream, Charset encoding)
  3. stringFromStream(InputStream in, Charset cs)
  4. toInputStream(final String string, final Charset charset)
  5. toInputStream(String input, Charset charset)
  6. toString(final InputStream input, final Charset encoding)
  7. toString(InputStream in, Charset charset)
  8. toString(InputStream in, Charset charset)
  9. toString(InputStream in, Charset charset)