Android Utililty Methods String to InputStream Convert

List of utility methods to do String to InputStream Convert

Description

The list of methods to do String to InputStream Convert are organized into topic(s).

Method

InputStreamString2InputStream(String str)
String Input Stream
ByteArrayInputStream stream = null;
try {
    stream = new ByteArrayInputStream(str.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
    e.printStackTrace();
return stream;
InputStreamStringToInputStream(String str)
String To Input Stream
if (TextUtils.isEmpty(str))
    return null;
ByteArrayInputStream stream = new ByteArrayInputStream(
        str.getBytes());
return stream;
InputStreamgetInputStream(String str)
get Input Stream
InputStream inputStream = new ByteArrayInputStream(str.getBytes());
return inputStream;
InputStreamStringTOInputStream(String in)
String TO Input Stream
ByteArrayInputStream is = new ByteArrayInputStream(in.getBytes());
return is;
InputStreamStringTOInputStream(String in)
String TO Input Stream
ByteArrayInputStream is = new ByteArrayInputStream(
        in.getBytes("ISO-8859-1"));
return is;
InputStreamStringTOInputStream(String in)
String TO Input Stream
ByteArrayInputStream is = new ByteArrayInputStream(
        in.getBytes("ISO-8859-1"));
return is;
InputStreamStringTOInputStream(String in, String encoding)
String TO Input Stream
try {
    ByteArrayInputStream is = new ByteArrayInputStream(
            in.getBytes("ISO-8859-1"));
    return is;
} catch (UnsupportedEncodingException e) {
    return null;
InputStreamStringTOInputStream(String str)
String to InputStream
ByteArrayInputStream is = new ByteArrayInputStream(
        str.getBytes("ISO-8859-1"));
return is;
InputStreamconvertToInputStream(String string)
convert To Input Stream
byte[] bytes = string.getBytes();
return new ByteArrayInputStream(bytes);