Convert String to InputStream - Java java.io

Java examples for java.io:InputStream Read

Description

Convert String to InputStream

Demo Code


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

import java.io.InputStream;

public class Main {


    public static InputStream toInputStream(final String in) {
        return new ByteArrayInputStream(in.getBytes());
    }/*from ww  w .  ja v a 2  s .c o m*/
}

Related Tutorials