Convert string to InputStream - Android java.io

Android examples for java.io:InputStream

Description

Convert string to InputStream

Demo Code

import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Locale;

public class Main{

    public static InputStream string2InputStream(String str) {
        ByteArrayInputStream stream = new ByteArrayInputStream(
                str.getBytes());/*from ww w  .  ja  v a 2 s.  c  om*/
        return stream;
    }

}

Related Tutorials