code: public static InputStream wrapString(String str, Charset charset) {   
      return new ByteArrayInputStream(str.getBytes(charset));  
    }
docs: Wraps the provided string into an InputStream.
  
  @param str String to wrap.
  @param charset the chareset encoding of the string
  @return InputStream containing the string argument.