public static InputStream toInputStream(String input){
  byte[] bytes=input.getBytes();
  return new ByteArrayInputStream(bytes);
}

public static InputStream toInputStream ( String input ) { byte [ ] bytes = input . getBytes ( ) ; return new ByteArrayInputStream ( bytes ) ; }
convert the specified string to an input stream , encoded as bytes using the default character encoding of the platform .
